Permission control is an indispensable part of a mature application. How to design a privilege mechanism that can meet both general needs and expand, and applying simple perfect perfect, which is what I face, now let me start Bar. First, define the role of the permission system, one sentence: "What can I do?" There are three elements, 1. I defined as Person 2. Can not be defined as true / false 3. What to define as function first define an application interface PUBLIC Interface ISecurity {/ * Judging whether a user has a certain permission * / public boolean CAN (int Personid, int functionID); / * Give a user setting permission * / public void setsecurity (int Personid, int functionid, Boolean CAN);} The most basic operation can be achieved through a specific implementation. For example, three tableson (ID, name) Func (ID, name) Security (Person, FUNC) each "I" is for every "what to do", "can you" then, the problem is coming, Do you have to define a defined for each function? A: This question is to see your preference, you can only be explicitly allowed, otherwise it is not allowed; it can also be allowed to be allowed.