Permissions with Adonis Guard

Hello every one, I need a help, I have an Api Project which need a permission model for Admins and normal users.

In my project, I need to save all permissions on the database, and my Admins can need to apply those permissions for users, for example, the user can add other users, can change the group name and more…

Can i make this with Adonis Guard? If yes, how I can to make?

An another question, When my permissions are changed, I need to apply in the same time to the user, How I can make this?

Regards :slight_smile:

I’ll do that by adding a field in table and writing a middleware

2 Likes

Hi!

There’s quite cool project https://github.com/QuantumLabsLtda/adonisjs-cerberus

That might be useful :slight_smile:

Edit: Aah… My bad… I thought you meant Adonis Auth not Adonis Guard :man_facepalming:
I have no idea how Adonis Guard works :frowning:

2 Likes

Hi i think its better to use adonis acl package https://github.com/enniel/adonis-acl which help you easily handle user permission.

HI @McSneaky, It’s looks like good, you know if I can create custom rules? I’m see, the default rules in the documentation eg, read, delete and others rules, I can edit the default migration to add my custom rules?

Hi @romelo, I Can use Adonis ACL with a table in my database? If Yes, Can you give me a example please?

This is the correct way, after looked at all suggestion here, I’m choosed to make my custom permission system. My project need of flexible permissions and no any sollution can be so flexible, how I need.

Thank you very much to all for you attention :slight_smile:

1 Like

Yes it actually creates a roles table etc… check the documentation out and if you are finding difficulties implementing it let me know so that i can help you add it in your project.

1 Like

There are some possibilities like @romelo suggested but making your own is damn flexible.

1 Like