#34: added access rights to Hooks only for global admins

This commit is contained in:
Vokhmin Alexey V 2013-05-17 00:07:40 +04:00
parent 72b2b637d1
commit 6cf7a2e21d
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,8 @@
# -*- encoding : utf-8 -*- # -*- encoding : utf-8 -*-
class Projects::HooksController < Projects::BaseController class Projects::HooksController < Projects::BaseController
before_filter :authenticate_user! before_filter :authenticate_user!
# TODO: remove
before_filter lambda { raise CanCan::AccessDenied unless current_user.admin? }
load_and_authorize_resource :project load_and_authorize_resource :project
load_and_authorize_resource :hook, :through => :project load_and_authorize_resource :hook, :through => :project

View File

@ -10,8 +10,9 @@
= link_to t("layout.projects.edit"), edit_project_path(@project) = link_to t("layout.projects.edit"), edit_project_path(@project)
%li{:class => (act == :sections && contr == :projects) ? 'active' : ''} %li{:class => (act == :sections && contr == :projects) ? 'active' : ''}
= link_to t("layout.projects.sections"), sections_project_path(@project) = link_to t("layout.projects.sections"), sections_project_path(@project)
%li{:class => (contr == :hooks) ? 'active' : ''} - if current_user.admin? # TODO: remove
= link_to t("layout.projects.hooks"), project_hooks_path(@project) %li{:class => (contr == :hooks) ? 'active' : ''}
= link_to t("layout.projects.hooks"), project_hooks_path(@project)
- if can? :manage_collaborators, @project - if can? :manage_collaborators, @project
%li{:class => (act == :index && contr == :collaborators) ? 'active' : ''} %li{:class => (act == :index && contr == :collaborators) ? 'active' : ''}
= link_to t("layout.projects.edit_collaborators"), project_collaborators_path(@project) = link_to t("layout.projects.edit_collaborators"), project_collaborators_path(@project)