aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-08-09 15:35:03 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-08-11 20:03:02 +0200
commit264545996c27fea790b4a7ebf27122ec0748a630 (patch)
tree50e112e271f9d77748f86e08474c42998e8c030b /app
parentRecognize users that register using OpenID from dev.gentoo.org as mentors (diff)
downloadrecruiting-webapp-264545996c27fea790b4a7ebf27122ec0748a630.tar.gz
recruiting-webapp-264545996c27fea790b4a7ebf27122ec0748a630.tar.bz2
recruiting-webapp-264545996c27fea790b4a7ebf27122ec0748a630.zip
Don't show input for mentors to users who can't edit it
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 7ff0640..cb6afbe 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -105,7 +105,11 @@ class User < ActiveRecord::Base
end
def mentor_edit_permitted?
- mentor.nil? || mentor_is?(acting_user)
+ return true if mentor_is?(acting_user)
+ return true if mentor.nil? && acting_user.role.is_mentor?
+ return true if mentor.nil? && acting_user.role.is_recruiter?
+ return true if acting_user.administrator?
+ false
end
def destroy_permitted?