Sha256: 82d7dd735da3921b67a728e9e8984313dfd93ba5f17bca46c46dede3866ecd71
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 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 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
isomorfeus-policy-1.0.0.epsilon1 | README.md |
isomorfeus-policy-1.0.0.delta12 | README.md |