/// <summary>Gets the access rights for the identity on the provided security descriptor.</summary> /// <param name="sd">The security descriptor to check for access rights.</param> /// <param name="sid">The SID of the identity for which to get the rights.</param> /// <returns>The access rights bitmask.</returns> public static uint GetEffectiveRights(this RawSecurityDescriptor sd, SecurityIdentifier sid) { BuildTrusteeWithSid(out var t, GetPSID(sid)); using var pDacl = new PinnedAcl(sd.DiscretionaryAcl); GetEffectiveRightsFromAcl(pDacl.PACL, t, out var access); return(access); }
public static uint GetEffectiveRights(this RawSecurityDescriptor sd, SecurityIdentifier sid) { var t = new TRUSTEE(GetPSID(sid)); uint access = 0; using (var pDacl = new PinnedAcl(sd.DiscretionaryAcl)) GetEffectiveRightsFromAcl(pDacl, t, ref access); return(access); }