Class: ApplicationPolicy
- Inherits:
-
Object
- Object
- ApplicationPolicy
- Defined in:
- lib/generators/verikloak/pundit/install/templates/application_policy.rb
Overview
Base Pundit policy for applications using verikloak-pundit.
This class is intended as a starting point. Override per-action predicates (e.g., show?, update?) in your concrete policies.
Defined Under Namespace
Classes: Scope
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #create? ⇒ Boolean
- #destroy? ⇒ Boolean
- #edit? ⇒ Boolean
- #index? ⇒ Boolean
-
#initialize(user, record) ⇒ ApplicationPolicy
constructor
useris a Verikloak::Pundit::UserContext. - #new? ⇒ Boolean
- #show? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(user, record) ⇒ ApplicationPolicy
user is a Verikloak::Pundit::UserContext
13 14 15 16 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 13 def initialize(user, record) @user = user @record = record end |
Instance Attribute Details
#record ⇒ Object (readonly)
Returns the value of attribute record.
8 9 10 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 8 def record @record end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
8 9 10 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 8 def user @user end |
Instance Method Details
#create? ⇒ Boolean
23 24 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 23 def create? = false # @return [Boolean] |
#destroy? ⇒ Boolean
31 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 31 def destroy? = false |
#edit? ⇒ Boolean
29 30 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 29 def edit? = update? # @return [Boolean] |
#index? ⇒ Boolean
19 20 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 19 def index? = false # @return [Boolean] |
#new? ⇒ Boolean
25 26 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 25 def new? = create? # @return [Boolean] |
#show? ⇒ Boolean
21 22 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 21 def show? = false # @return [Boolean] |
#update? ⇒ Boolean
27 28 |
# File 'lib/generators/verikloak/pundit/install/templates/application_policy.rb', line 27 def update? = false # @return [Boolean] |