简体   繁体   中英

roles and permissions for membership website

I have a site which utilises 3 types of users-

 1. "admin"  
 2. "employee"
 3. "employer"

I'm trying to understand if I now create a " paid " membership for the " employer ", which has added features/benefits over a now "free/standard" employer whether they should be seen as two different roles OR just different permissions.

Using Laravel Entrust Roles/Permissions.

I would appreciate justification why one over the other, or when is the tipping point to use one over the other, alternatively another way all together. I have not been able to find a definitive answer.

Although I'm not familiar with Laravel , I'm guessing you are using Role-based Access Control. In those cases, roles define sets of permissions.

whether they should be seen as two different roles OR just different permissions.

I would just use different roles and let the code flow more naturally. Imagine you have some button that depends on being employer or not, and does different things if you are employer with paid subscription or not. If you use roles, all you have to do is check the role and you know what to do. If you use, however, the same role with different permissions, you will have 2 layers of verification, one to check the role, and another to check permissions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM