diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index d3c262d..079b870 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -26,6 +26,32 @@ class User < ActiveRecord::Base end end + def join_groups(join=[]) + # FIXME: race condition + join.each do |group| + case group + when :admin + groups |= 2 + when :host + groups |= 1 + else + end + end + end + + def leave_groups(leave=[]) + # FIXME: race condition + leave.each do |group| + case group + when :admin + groups &= ~ 2 + when :host + groups &= ~ 1 + else + end + end + end + ## # VAILD_EMAIL is the regex used to validate a user given email. VALID_EMAIL_REG = /\A\S+@\S+\.\S+\z/i |