mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-13 13:21:29 +00:00
Add protection for important groups
This commit is contained in:
parent
8b2ce91625
commit
dd0e3c2c38
1 changed files with 6 additions and 2 deletions
|
@ -49,7 +49,11 @@ class Group < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def can_destroy? cuser
|
||||
cuser and cuser.admin? and id != Group::ADMINS
|
||||
cuser and cuser.admin? and id != Group::ADMINS and !Group.protected_groups.include?(id)
|
||||
end
|
||||
|
||||
def self.protected_groups
|
||||
Group.constants(false).map {|n| Group.const_get(n)}
|
||||
end
|
||||
|
||||
def self.staff
|
||||
|
@ -124,6 +128,6 @@ class Group < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:gather).permit(:task)
|
||||
params.require(:group).permit(:name)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue