add permission helpers for view project and experiment

This commit is contained in:
zmagod 2018-01-23 08:52:10 +01:00
parent ee7c646b1d
commit 259880c441

View file

@ -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