permission system in details - b1412/clojure-web-admin GitHub Wiki
This project support organization-based data-level authentication.
You should add a column named ‘creater_id’ to your table, and add ‘belongs-to’ relationship to ‘User’ entity in you entity definition.
(defent computer
(k/belongs-to user {:fk :creator_id}))Then you can query the table depend on current logged-in user.
The following operation scope are supported out of the box:
- System - Operate all the records in the table
- orgs - Operate records created by users in his/her organization and all the sub-organizations
- org - Operate records created by users in his/her organization
- user - Operate records created by himself/herself
The query API is korma API compatible, which can suit your basic requirements.
query-entity([entity params])