about summary refs log tree commit diff
path: root/app/models/concerns/user_roles.rb
diff options
context:
space:
mode:
authorReverite <github@reverite.sh>2019-06-26 20:31:07 -0700
committerReverite <github@reverite.sh>2019-06-26 20:31:07 -0700
commit3fa90982efda2109ddf90d81f5ed3449f8282642 (patch)
treee5514f4c72c9ffb44059a2afb7fdf24d0348bbd4 /app/models/concerns/user_roles.rb
parent714940de498e93a8bf40dcda1835217df18741bf (diff)
parent9ef25877dfda12cf31ec586294e4d4908f5be4f0 (diff)
Merge branch 'glitch' into production
Diffstat (limited to 'app/models/concerns/user_roles.rb')
-rw-r--r--app/models/concerns/user_roles.rb14
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'