The admin-user-roles-permissions
has basic support for handling user permissions in the Keystone admin area.
It is comprised of basic parts:
-
Additional fields on the user model (mentioned in steps below and also the User.js file)
isUserAdmin
,isSuperAdmin
andisPWD
(the last one has permissions to edit any other user always)- Simply, each user has the ability to edit self and all users with fewer permissions.
-
Exposure of these values (via virtuals) to the React
admin/src/views/item.js
route and to the server side jade templates and express routes.- Modification of the React and jade templates to display users according to the permisions.
-
Selection from mongoose of fields that don't display in the list. (
684a79f
)- This allows hiding of users in the main list without showing the role information used in the selection logic.
-
Express middleware
userHandler
(313649e
) to end requests to user items that the logged in user isn't allowed.
Hi. Thanks for this. But I don't get one big point:
Why you guys don't create ONE FIELD: role = "Admin | UserAdmin | SuperAdmin | PWD" instead of making all complications of 4 fields?