Sha256: 0bcd086257c87554b0b6fad32fbfb5d7f7214974fb56257b956fd1f1e9ef7b5c
Contents?: true
Size: 1.37 KB
Versions: 8
Compression:
Stored size: 1.37 KB
Contents
# isomorfeus-policy Policy for Isomorfeus Policy is enforced on the server, however, the same policy rules are also available on the client to allow for making consistent decisions everywhere. ## Usage Everything that is not explicitly allowed somewhere is denied. Place the policy file in your projects `isomorfeus/policies`. Example Policy: ```ruby class MySimplePolicy < LucidPolicy::Base policy_for UserOrRoleClass allow BlaBlaGraph, :load deny BlaGraph, SuperOperation deny others # or: allow others # in a otherwise empty policy the following can be used too: # allow all # deny all with_condition do |user_or_role_instance, target_class, target_method, *props| role.class == AdminRole end refine BlaGraph, :load, :count do |user_or_role_instance, target_class, target_method, *props| allow if user_or_role_instance.verified? deny end end ``` and then any of: ```ruby user_or_role_instance.authorized?(target_class) user_or_role_instance.authorized?(target_class, target_method) user_or_role_instance.authorized?(target_class, target_method, *props) ``` or: ```ruby user_or_role_instance.authorized!(target_class) user_or_role_instance.authorized!(target_class, target_method) user_or_role_instance.authorized!(target_class, target_method, *props) ``` which will raise a LucidPolicy::Exception unless authorized
Version data entries
8 entries across 8 versions & 1 rubygems