summaryrefslogtreecommitdiff
path: root/lib/authenticated_system.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-31 15:55:43 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-31 15:55:43 +0200
commit464dd4266bdc433805010b5dca428f4cb75c2a81 (patch)
tree47fdf4f065960d49da015eafdf56cb817dcf9ea4 /lib/authenticated_system.rb
parent5f17f421b176d48ef556fb379f59bbb7d284b48e (diff)
Group user accounts by role
Replaces the two-way admin/user split with four groups ordered by capability: administration, Redaktion, editors, alumni. alumni takes precedence over capability in role_group, so a retired admin appears at the bottom rather than the top. Forms now offer the three roles as checkboxes rather than a single admin checkbox, with a trailing hidden blank so an empty set can be posted, and user_params permits roles only for admins. Three create buttons prefill the common combinations.
Diffstat (limited to 'lib/authenticated_system.rb')
-rw-r--r--lib/authenticated_system.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/authenticated_system.rb b/lib/authenticated_system.rb
index 2ec15a77..4e70c28d 100644
--- a/lib/authenticated_system.rb
+++ b/lib/authenticated_system.rb
@@ -102,7 +102,12 @@ module AuthenticatedSystem
102 def login_from_session 102 def login_from_session
103 return unless session[:user_id] 103 return unless session[:user_id]
104 if session[:logged_in_at].to_i > SESSION_MAX_AGE.ago.to_i 104 if session[:logged_in_at].to_i > SESSION_MAX_AGE.ago.to_i
105 self.current_user = User.find_by(:id => session[:user_id]) 105 user = User.find_by(:id => session[:user_id])
106 if user.nil? || user.alumni?
107 session[:user_id] = nil
108 else
109 self.current_user = user
110 end
106 else 111 else
107 session[:user_id] = nil 112 session[:user_id] = nil
108 end 113 end