aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 9c160dbd5..9c68ff0aa 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.61 2008-08-09 15:19:01 francis Exp $
+# $Id: user.rb,v 1.62 2008-08-27 00:39:03 francis Exp $
require 'digest/sha1'
@@ -41,6 +41,11 @@ class User < ActiveRecord::Base
attr_accessor :password_confirmation
validates_confirmation_of :password, :message =>"^Please enter the same password twice"
+ validates_inclusion_of :admin_level, :in => [
+ 'none',
+ 'super',
+ ]
+
acts_as_xapian :texts => [ :name ],
:values => [ [ :created_at, 0, "created_at", :date ] ],
:terms => [ [ :variety, 'V', "variety" ] ]
@@ -148,9 +153,14 @@ class User < ActiveRecord::Base
u.save!
end
- return u
+ return
end
+ # Does the user magically gain powers as if they owned every request?
+ # e.g. Can classify it
+ def owns_every_request?
+ self.admin_level == 'super'
+ end
private