How can I design a super administrator with user permissions?

Source: Internet
Author: User
How can I design a super administrator with user permissions? When developing a member management system, you want to have the permissions of a super administrator to perform any operations without knowing how to distinguish it from other users. now you want to make the program accessible by default as a super administrator, then other users can judge based on the permissions passed in, but are worried about poor writing. other users can also obtain the permissions of the Super Administrator, or you can only use a lot of if else to determine whether the super administrator privilege is too troublesome. how can you design it better?


Reply to discussion (solution)

There are no differences between super administrators and users in the algorithm itself
You only grant different permissions to different users. Obviously, the super administrator is granted all permissions.
For access by default as a super administrator, that is, the permissions you set are not "allowed", but "forbidden"

There are no differences between super administrators and users in the algorithm itself
You only grant different permissions to different users. Obviously, the super administrator is granted all permissions.
For access by default as a super administrator, that is, the permissions you set are not "allowed", but "forbidden"

According to my understanding, the so-called permission control is essentially different from if/else, right? Is there any other method for the big edition?

There are no differences between super administrators and users in the algorithm itself
You only grant different permissions to different users. Obviously, the super administrator is granted all permissions.
For access by default as a super administrator, that is, the permissions you set are not "allowed", but "forbidden"

For example, if I have an activity page, ordinary members can only see their own activities, while Super administrators can see all created activities, I don't know how to design a page that is not simply forbidden access.

You have read range permission.
You can set two permission bits: the primary key, and other
Super Administrator: 00
User: 01

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.