mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
add permission helpers for view project and experiment
This commit is contained in:
parent
ee7c646b1d
commit
259880c441
1 changed files with 16 additions and 0 deletions
|
@ -117,3 +117,19 @@ Canaid::Permissions.register_for(RepositoryColumn) do
|
|||
can_create_repository_columns?(user, repository_column.repository.team)
|
||||
end
|
||||
end
|
||||
|
||||
Canaid::Permissions.register_for(Project) do
|
||||
# view project
|
||||
can :read_project do |user, project|
|
||||
user.is_admin_of_team?(project.team) ||
|
||||
user.is_member_of_project?(project) ||
|
||||
(project.visible? && user.is_member_of_team?(project.team))
|
||||
end
|
||||
end
|
||||
|
||||
Canaid::Permissions.register_for(Experiment) do
|
||||
# view experiment
|
||||
can :read_experiment do |user, experiment|
|
||||
user.is_member_of_team?(experiment.project.team)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue