diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-06-20 02:52:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-20 02:52:34 +0200 |
commit | 7696f77245c2302787d239da50248385b3292a5e (patch) | |
tree | 81db43f660c382679cc7a834d0be06c0218592a8 /app/models/concerns | |
parent | 33144e132d28f5b820ae12e4b8e4fb34ca47b1d6 (diff) |
Add moderation API (#9387)
Fix #8580 Fix #7143
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/user_roles.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/concerns/user_roles.rb b/app/models/concerns/user_roles.rb index 58dffdc46..a42b4a172 100644 --- a/app/models/concerns/user_roles.rb +++ b/app/models/concerns/user_roles.rb @@ -13,6 +13,20 @@ module UserRoles admin? || moderator? end + def role=(value) + case value + when 'admin' + self.admin = true + self.moderator = false + when 'moderator' + self.admin = false + self.moderator = true + else + self.admin = false + self.moderator = false + end + end + def role if admin? 'admin' |