public override bool Equals(object obj) { RbacPermission otherPermission = obj as RbacPermission; if (obj == null) { return(false); } return(Name == otherPermission.Name); }
public bool HasPermission(RbacPermission permission) { return(Permissions.Contains(permission) || SubRoles.Any((RbacRole obj) => obj.HasPermission(permission))); }
/// <summary> /// Recursively works out whether this user has the specified permission. /// </summary> /// <param name="permission">The permission to search for.</param> /// <returns>Whether this user has the specified permission through one of their roles or not.</returns> public bool HasPermission(RbacPermission permission) { return(Roles.Any((RbacRole role) => role.HasPermission(permission))); }