Use more naturally-sounding ensures
These match Basecamp and the existing predicate methods
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
class AdminController < ApplicationController
|
||||
before_action :ensure_is_staff_member
|
||||
before_action :ensure_staff
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
module Authorization
|
||||
private
|
||||
def ensure_can_administer
|
||||
def ensure_admin
|
||||
head :forbidden unless Current.user.admin?
|
||||
end
|
||||
|
||||
def ensure_is_staff_member
|
||||
def ensure_staff
|
||||
head :forbidden unless Current.user.staff?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Webhooks::ActivationsController < ApplicationController
|
||||
before_action :ensure_can_administer
|
||||
before_action :ensure_admin
|
||||
before_action :set_webhook
|
||||
|
||||
def create
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class WebhooksController < ApplicationController
|
||||
before_action :ensure_can_administer
|
||||
before_action :ensure_admin
|
||||
before_action :set_collection
|
||||
before_action :set_webhook, except: %i[ index new create ]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user