summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb15
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