/// <summary> /// Gets a value indicating whether the specified identity is a member of the specified permission scope. /// </summary> /// <param name="type">Identity scope.</param> /// <param name="identity">Identity.</param> /// <param name="scope">Permissions scope.</param> /// <returns>True is the specified identity is within the specified scope, otherwise false.</returns> public bool IsIdentityInPermissionScope(IdentityScope type, string identity, PermissionScope scope) { var si = SecurityIdentity.Create(type, identity); // TODO: Consider making a virtual hash set and calling contains (it'll be faster). return(this.GetScopeIdentities(scope, type).Any(i => i.Equals(si))); }
/// <summary> /// Revoke the specified identity for the specified permission scope. /// </summary> /// <param name="type">Type of Identity (Group, User)</param> /// <param name="identity">Identity to revoke permissions from (DOMAIN\user).</param> /// <param name="scope">Scope of permissions to revoke (Owner, Writer, Reader)</param> public void Revoke(IdentityScope type, string identity, PermissionScope scope) { Revoke(SecurityIdentity.Create(type, identity), scope); }
/// <summary> /// Grant the specified identity for the specified permission scope. /// </summary> /// <param name="type">Type of Identity (Group, User)</param> /// <param name="identity">Identity to grant permissions to (DOMAIN\user).</param> /// <param name="scope">Scope of permissions to grant (Owner, Writer, Reader)</param> public void Grant(IdentityScope type, string identity, PermissionScope scope) { Grant(SecurityIdentity.Create(type, identity), scope); }