public void Grant(Grant grant) { if (grant == null) { throw new ArgumentNullException("grant"); } var objectType = grant.ObjectType; var objectName = grant.ObjectName; var privileges = grant.Privileges; Privileges oldPrivs = GetPrivileges(grant.Grantee, objectType, objectName, grant.WithOption); privileges |= oldPrivs; if (!oldPrivs.Equals(privileges)) { UpdateUserGrants(objectType, objectName, grant.GranterName, grant.Grantee, privileges, grant.WithOption); } }
public void GrantToUser(string userName, Grant grant) { if (String.IsNullOrEmpty(userName)) { throw new ArgumentNullException("userName"); } if (grant == null) { throw new ArgumentNullException("grant"); } var objectType = grant.ObjectType; var objectName = grant.ObjectName; var privileges = grant.Privileges; Privileges oldPrivs = GetUserPrivileges(userName, objectType, objectName, grant.WithOption); privileges |= oldPrivs; if (!oldPrivs.Equals(privileges)) { UpdateUserGrants(objectType, objectName, grant.GranterName, userName, privileges, grant.WithOption); } }