app controller: replace calls to access_denied with PrivilegeError.
Standardize controllers to raise User::PrivilegeError instead of calling `access_denied` directly.
This commit is contained in:
@@ -23,13 +23,10 @@ class BulkUpdateRequestsController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
if @bulk_update_request.editable?(CurrentUser.user)
|
||||
@bulk_update_request.update(bur_params(:update))
|
||||
flash[:notice] = "Bulk update request updated"
|
||||
respond_with(@bulk_update_request, :location => bulk_update_requests_path)
|
||||
else
|
||||
access_denied()
|
||||
end
|
||||
raise User::PrivilegeError unless @bulk_update_request.editable?(CurrentUser.user)
|
||||
|
||||
@bulk_update_request.update(bur_params(:update))
|
||||
respond_with(@bulk_update_request, location: bulk_update_requests_path, notice: "Bulk update request updated")
|
||||
end
|
||||
|
||||
def approve
|
||||
@@ -38,13 +35,10 @@ class BulkUpdateRequestsController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @bulk_update_request.rejectable?(CurrentUser.user)
|
||||
@bulk_update_request.reject!(CurrentUser.user)
|
||||
flash[:notice] = "Bulk update request rejected"
|
||||
respond_with(@bulk_update_request, :location => bulk_update_requests_path)
|
||||
else
|
||||
access_denied()
|
||||
end
|
||||
raise User::PrivilegeError unless @bulk_update_request.rejectable?(CurrentUser.user)
|
||||
|
||||
@bulk_update_request.reject!(CurrentUser.user)
|
||||
respond_with(@bulk_update_request, location: bulk_update_requests_path, notice: "Bulk update request rejected")
|
||||
end
|
||||
|
||||
def index
|
||||
|
||||
Reference in New Issue
Block a user