dalyIsaac / keystone-classic

WIP Keystone JS with User Permissions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

title
KeystoneJS - User Permissions Updates

Updates keystone with user privileges.

list.options.restrict = {
    match: { 
        //Restricts which documents are returned (in Keystone), based on the users' details
        //Shows all documents if user's role has isAdmin = true, or if the user has the correct field
        
        from: //field in User object to match - this accepts an array field
        path: //field in this List to match 
    },
    
    rolesCanView: [
        //Hides entire list unless role.isAdmin = true, or has the required role.
    ],
    rolesCanEdit: [
        //Prevents saving changes to documents unless role.isAdmin = true, or has the required role.
    ]
}

Keystone must be init with 'user roles', an array like this:

[
	{value: 1, label:'Admin', isAdmin:true},
	{value: 2, label:'User', isAdmin:false},
];

About

WIP Keystone JS with User Permissions

License:MIT License


Languages

Language:JavaScript 88.4%Language:Less 5.8%Language:PHP 2.8%Language:CSS 1.7%Language:Pug 1.0%Language:HTML 0.3%Language:Shell 0.0%