diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-03-05 22:38:27 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-03-05 22:38:27 -0500 |
commit | a685379aa599bac6a96f657088c8df3cbcec3d22 (patch) | |
tree | 80938f3fed4fe2129d74623b8308d9221dc3f84f /app | |
parent | 29a6a1a74bd16106b825cf7d23501344843c7c3c (diff) |
User model: implement #in_group?
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index db65dc4..d3c262d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,6 +11,21 @@ class User < ActiveRecord::Base # as private. before_create :create_remember_token + def in_group?(group) + case group + when :admin + return ((groups & 2) != 0) + when :host + return ((groups & 1) != 0) + when :player + return true + when :specator + return true + else + return false + end + end + ## # VAILD_EMAIL is the regex used to validate a user given email. VALID_EMAIL_REG = /\A\S+@\S+\.\S+\z/i |