Skip to content

How to add roles based permision which can be updated #379

Answered by fgatti675
edden-app asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @edden-app

You can create a user collection where you define the roles:

export const userCollection = buildCollection<AdminUser>({
    name: "Users",
    customId: true, // Use email as ID
    properties: {
        name: {
            dataType: "string",
            name: "Name"
        },
        roles: {
            dataType: "array",
            name: "Roles",
            of:{
                dataType:"string",
                config:{
                    enumValues: {
                      admin: "Admin",
                      editor: "Editor",
                  }
                }
            }
        },
    }
});

Then use a custom authenticator to set your custom data in the au…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@edden-app
Comment options

Answer selected by fgatti675
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants