diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-05-21 08:07:19 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-05-21 10:49:07 +0200 |
commit | 53b3c32a0fa2d119c859e56c6b02680658c4a804 (patch) | |
tree | f9e576dced753f6120b8028bc1ec1d94fa8c52c7 /app | |
parent | Generated Question and QuestionCategory models. (diff) | |
download | recruiting-webapp-53b3c32a0fa2d119c859e56c6b02680658c4a804.tar.gz recruiting-webapp-53b3c32a0fa2d119c859e56c6b02680658c4a804.tar.bz2 recruiting-webapp-53b3c32a0fa2d119c859e56c6b02680658c4a804.zip |
Permissions Question and QuestionCategory models
Created Permissions::AnyoneCanViewRecruiterCanChange module and used it
to add permissions for Question and QuestionCategory models.Added
Permissions::TestPermissions module and used it to tests
permissions for Question and QuestionCategoryfor Created users fixture
tests for User and Question now use fixture.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/question.rb | 18 | ||||
-rw-r--r-- | app/models/question_category.rb | 18 | ||||
-rw-r--r-- | app/models/user.rb | 4 |
3 files changed, 6 insertions, 34 deletions
diff --git a/app/models/question.rb b/app/models/question.rb index 0afbd16..6604bef 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -10,22 +10,6 @@ class Question < ActiveRecord::Base end belongs_to :question_category - # --- Permissions --- # - - def create_permitted? - acting_user.administrator? - end - - def update_permitted? - acting_user.administrator? - end - - def destroy_permitted? - acting_user.administrator? - end - - def view_permitted?(field) - true - end + include Permissions::AnyoneCanViewRecruiterCanChange end diff --git a/app/models/question_category.rb b/app/models/question_category.rb index af4b0fd..16fbc2a 100644 --- a/app/models/question_category.rb +++ b/app/models/question_category.rb @@ -8,22 +8,6 @@ class QuestionCategory < ActiveRecord::Base end has_many :questions - # --- Permissions --- # - - def create_permitted? - acting_user.administrator? - end - - def update_permitted? - acting_user.administrator? - end - - def destroy_permitted? - acting_user.administrator? - end - - def view_permitted?(field) - true - end + include Permissions::AnyoneCanViewRecruiterCanChange end diff --git a/app/models/user.rb b/app/models/user.rb index 77eeba4..08b47c6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -62,6 +62,10 @@ class User < ActiveRecord::Base true end + def self.user_is_recruiter?(user) + user.signed_up? && user.role.is_recruiter? + end + protected def only_recruiter_can_be_administrator |