aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorfrancis <francis>2008-08-27 00:39:03 +0000
committerfrancis <francis>2008-08-27 00:39:03 +0000
commit79f4c456c9c435f72dfd5ec5fce1049f57947a75 (patch)
tree2b091ad19113e50308c9aaf479d8a5c79f02f36f /app/models
parent18d4c071bd737f16bc135727087e5ebdbced97c1 (diff)
Admin level field for users.
Edit users from admin interface. Let admin users classify any request from main website interface. Give admin users links from users/bodies/requests to admin interface.
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