public void Grant(OrderedHashSet <string> granteeList, ISchemaObject[] routines, Right right, Grantee grantor, bool withGrantOption) { bool flag = false; for (int i = 0; i < routines.Length; i++) { if (grantor.IsGrantable(routines[i], right)) { this.Grant(granteeList, routines[i], right, grantor, withGrantOption); flag = true; } } if (!flag) { throw Error.GetError(0x7d0, grantor.GetNameString()); } }
public void Grant(OrderedHashSet <string> granteeList, ISchemaObject dbObject, Right right, Grantee grantor, bool withGrantOption) { RoutineSchema schema = dbObject as RoutineSchema; if (schema != null) { ISchemaObject[] specificRoutines = schema.GetSpecificRoutines(); this.Grant(granteeList, specificRoutines, right, grantor, withGrantOption); } else { QNameManager.QName specificName = dbObject.GetName(); Routine routine = dbObject as Routine; if (routine != null) { specificName = routine.GetSpecificName(); } if (!grantor.IsGrantable(dbObject, right)) { throw Error.GetError(0x7d0, grantor.GetNameString()); } if (grantor.IsAdmin()) { grantor = dbObject.GetOwner(); } this.CheckGranteeList(granteeList); for (int i = 0; i < granteeList.Size(); i++) { Grantee role = this.Get(granteeList.Get(i)); role.Grant(specificName, right, grantor, withGrantOption); if (role.IsRole) { this.UpdateAllRights(role); } } } }
public void Grant(string granteeName, string roleName, Grantee grantor) { Grantee role = this.Get(granteeName); if (role == null) { throw Error.GetError(0xfa1, granteeName); } if (IsImmutable(granteeName)) { throw Error.GetError(0xfa2, granteeName); } Grantee grantee2 = this.GetRole(roleName); if (grantee2 == null) { throw Error.GetError(0x898, roleName); } if (grantee2 == role) { throw Error.GetError(0x8cb, granteeName); } if (grantee2.HasRole(role)) { throw Error.GetError(0x8cb, roleName); } if (!grantor.IsGrantable(grantee2)) { throw Error.GetError(0x7d0, grantor.GetNameString()); } role.Grant(grantee2); role.UpdateAllRights(); if (role.IsRole) { this.UpdateAllRights(role); } }