mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Minor experiment level permissions refactoring.
This commit is contained in:
parent
0706d16020
commit
879eda2d8f
1 changed files with 4 additions and 9 deletions
|
@ -2,15 +2,10 @@ Canaid::Permissions.register_for(Experiment) do
|
|||
# experiment: read
|
||||
# canvas/workflow: read
|
||||
can :read_experiment do |user, experiment|
|
||||
# TODO: When rebasing on top of refactored projects permissions, just call
|
||||
# can_read_project?(user, experiment.project) instead
|
||||
user.is_member_of_project?(experiment.project) ||
|
||||
user.is_admin_of_team?(experiment.project.team) ||
|
||||
(experiment.project.visible? &&
|
||||
user.is_member_of_team?(experiment.project.team))
|
||||
can_read_project?(user, experiment.project)
|
||||
end
|
||||
|
||||
# experiment: create, update, delete
|
||||
# experiment: create/update/delete
|
||||
# canvas/workflow: edit
|
||||
# module: create
|
||||
can :manage_experiment do |user, experiment|
|
||||
|
@ -83,9 +78,9 @@ Canaid::Permissions.register_for(Protocol) do
|
|||
end
|
||||
end
|
||||
|
||||
# protocol in module: create, update, delete, unlink, revert, update from
|
||||
# protocol in module: create/update/delete, unlink, revert, update from
|
||||
# protocol in repository, update from file
|
||||
# step: create, update, delete, reorder
|
||||
# step: create/update/delete, reorder
|
||||
can :manage_protocol_in_module do |user, protocol|
|
||||
if protocol.in_module?
|
||||
my_module = protocol.my_module
|
||||
|
|
Loading…
Reference in a new issue