Skip to content
Snippets Groups Projects

Create new policies for read, destroy, and create tokens

Merged Serena Fang requested to merge sfang-token-read-write-permissions into master
All threads resolved!
Compare and
23 files
+ 237
61
Compare changes
  • Side-by-side
  • Inline
Files
23
@@ -6,7 +6,9 @@ class AccessTokensController < Projects::ApplicationController
include ProjectsHelper
layout 'project_settings'
before_action :check_feature_availability
before_action -> { check_permission(:read_resource_access_tokens) }, only: [:index]
before_action -> { check_permission(:destroy_resource_access_tokens) }, only: [:revoke]
before_action -> { check_permission(:create_resource_access_tokens) }, only: [:create]
feature_category :authentication_and_authorization
@@ -43,8 +45,8 @@ def revoke
private
def check_feature_availability
render_404 unless project_access_token_available?(@project)
def check_permission(action)
render_404 unless can?(current_user, action, @project)
end
def create_params
Loading