atk4 / login

Add-on implementing User Login, Registration, Management and Password
https://agiletoolkit.org
MIT License
26 stars 22 forks source link

Add conditions to access rules #80

Open mkrecek234 opened 2 years ago

mkrecek234 commented 2 years ago

Feature request: Allow rules to include certain conditions to be applicable, notably for example: make rule applicable if mode entity's field user_id is or is not identical to logged in user_id, pr entity carries a reference to a user group (which is allowed to edit only for example.

Currently commented out. https://github.com/atk4/login/blob/3eecdc303dc053b026b2e91bfc5527c09f8e6b7e/src/Acl.php#L95

mvorisek commented 2 years ago

please always provide a link /w and specific hash/version git tag when refering to a code

mkrecek234 commented 2 years ago

To be more precise what use cases would be helpful for conditions in rules: 1) Simple: Filter model based on model field (e.g. all customers from Greece)

2) User-related 1: Filter all customers where customer->creator_id = logged-in user_id

3) User related 2; All customers where creator_id is also in same team as logged in user id

4) User related 3: All customers where 1:N model customer_accessusers also includes the logged-in user

mvorisek commented 2 years ago
  1. ... 4. can be easily added by hooking on the ADD persistence hook as the current Acl impl does.

if you want these conditions saveable as ACL rule, then scope serialization (or some more canonical export) should be implemented