# Control Center User Management Configuration Fragment

[[elements]]
border_bottom = false
border_top = true
name = "users_section_header"
title = "👥 User Management"
type = "section_header"

[[elements]]
default = true
help = "Enable user management"
name = "users_enabled"
nickel_path = ["users", "enabled"]
prompt = "Enable User Management"
type = "confirm"

# User Registration
[[elements]]
condition = "users_enabled == true"
default = true
help = "Enable user self-registration"
name = "users_registration_enabled"
nickel_path = ["users", "registration", "enabled"]
prompt = "Enable User Registration"
type = "confirm"

[[elements]]
condition = "users_enabled == true && users_registration_enabled == true"
default = false
help = "Require admin approval for new registrations"
name = "users_registration_requires_approval"
nickel_path = ["users", "registration", "requires_approval"]
prompt = "Require Registration Approval"
type = "confirm"

[[elements]]
condition = "users_enabled == true && users_registration_enabled == true"
default = "user"
help = "Default role for newly registered users"
name = "users_registration_auto_role"
nickel_path = ["users", "registration", "auto_assign_role"]
options = ["user", "operator", "viewer"]
prompt = "Default Registration Role"
type = "select"

# User Sessions
[[elements]]
condition = "users_enabled == true"
default = 5
help = "Maximum active sessions per user (range: 1-100)"
max = 100
min = 1
name = "users_sessions_max_active"
nickel_path = ["users", "sessions", "max_active"]
prompt = "Max Active Sessions per User"
type = "number"

[[elements]]
condition = "users_enabled == true"
default = 3600
help = "Session idle timeout in seconds (range: 300-86400)"
max = 86400
min = 300
name = "users_sessions_idle_timeout"
nickel_path = ["users", "sessions", "idle_timeout"]
prompt = "Session Idle Timeout (seconds)"
type = "number"

[[elements]]
condition = "users_enabled == true"
default = 86400
help = "Absolute session timeout in seconds (range: 3600-604800)"
max = 604800
min = 3600
name = "users_sessions_absolute_timeout"
nickel_path = ["users", "sessions", "absolute_timeout"]
prompt = "Absolute Session Timeout (seconds)"
type = "number"

# User Audit
[[elements]]
condition = "users_enabled == true"
default = false
help = "Enable audit logging for user actions"
name = "users_audit_enabled"
nickel_path = ["users", "audit_enabled"]
prompt = "Enable User Audit Logging"
type = "confirm"
