66
77using namespace std ;
88
9+ // RoleManager provides interface to define the operations for managing roles.
910class RoleManager {
1011 public:
11- /* *
12- * Clear clears all stored data and resets the role manager to the initial state.
13- */
14- virtual void Clear () = 0;
15-
16- /* *
17- * AddLink adds the inheritance link between two roles. role: name1 and role: name2.
18- * domain is a prefix to the roles.
19- *
20- * @param name1 the first role (or user).
21- * @param name2 the second role.
22- * @param domain the domain the roles belong to.
23- */
24- virtual void AddLink (string name1, string name2, vector<string> domain) = 0;
25-
26- /* *
27- * DeleteLink deletes the inheritance link between two roles. role: name1 and role: name2.
28- * domain is a prefix to the roles.
29- *
30- * @param name1 the first role (or user).
31- * @param name2 the second role.
32- * @param domain the domain the roles belong to.
33- */
34- virtual void DeleteLink (string name1, string name2, vector<string> domain) = 0;
35-
36- /* *
37- * hasLink determines whether a link exists between two roles. role: name1 inherits role: name2.
38- * domain is a prefix to the roles.
39- *
40- * @param name1 the first role (or a user).
41- * @param name2 the second role.
42- * @param domain the domain the roles belong to.
43- * @return whether name1 inherits name2 (name1 has role name2).
44- */
45- virtual bool HasLink (string name1, string name2, vector<string> domain) = 0;
46-
47- /* *
48- * GetRoles gets the roles that a user inherits.
49- * domain is a prefix to the roles.
50- *
51- * @param name the user (or a role).
52- * @param domain the domain the roles belong to.
53- * @return the roles.
54- */
55- virtual vector<string> GetRoles (string name, vector<string> domain) = 0;
56-
57- /* *
58- * GetUsers gets the users that inherits a role.
59- * @param name the role.
60- * @return the users.
61- */
62- virtual vector<string> GetUsers (string name, vector<string> domain) = 0;
63-
64- /* *
65- * PrintRoles prints all the roles to log.
66- */
67- virtual void PrintRoles () = 0;
12+ // Clear clears all stored data and resets the role manager to the initial state.
13+ virtual void Clear () = 0;
14+ // AddLink adds the inheritance link between two roles. role: name1 and role: name2.
15+ // domain is a prefix to the roles (can be used for other purposes).
16+ virtual void AddLink (string name1, string name2, vector<string> domain = vector<string>{}) = 0;
17+ // DeleteLink deletes the inheritance link between two roles. role: name1 and role: name2.
18+ // domain is a prefix to the roles (can be used for other purposes).
19+ virtual void DeleteLink (string name1, string name2, vector<string> domain = vector<string>{}) = 0;
20+ // HasLink determines whether a link exists between two roles. role: name1 inherits role: name2.
21+ // domain is a prefix to the roles (can be used for other purposes).
22+ virtual bool HasLink (string name1, string name2, vector<string> domain = vector<string>{}) = 0;
23+ // GetRoles gets the roles that a user inherits.
24+ // domain is a prefix to the roles (can be used for other purposes).
25+ virtual vector<string> GetRoles (string name, vector<string> domain = vector<string>{}) = 0;
26+ // GetUsers gets the users that inherits a role.
27+ // domain is a prefix to the users (can be used for other purposes).
28+ virtual vector<string> GetUsers (string name, vector<string> domain = vector<string>{}) = 0;
29+ // PrintRoles prints all the roles to log.
30+ virtual void PrintRoles () = 0;
6831};
6932
7033#endif
0 commit comments