public bool CheckAccess()

in CustomSecuritySample2016/Authorization.cs [111:146]


	  public bool CheckAccess(
	   string userName,
	   IntPtr userToken,
	   byte[] secDesc,
	   ModelOperation modelOperation)
	  {
      // If the user is the administrator, allow unrestricted access.
      // Because SQL Server defaults to case-insensitive, we have to
      // perform a case insensitive comparison. Ideally you would check
      // the SQL Server instance CaseSensitivity property before making
      // a case-insensitive comparison.
      if (0 == String.Compare(userName, m_adminUserName, true,
            CultureInfo.CurrentCulture))
        return true;

      AceCollection acl = DeserializeAcl(secDesc);
      foreach (AceStruct ace in acl)
      {
        // First check to see if the user or group has an access control 
        //  entry for the item
        if (0 == String.Compare(userName, ace.PrincipalName, true,
           CultureInfo.CurrentCulture))
        {
          // If an entry is found, 
          // return true if the given required operation
          // is contained in the ACE structure
          foreach (ModelOperation aclOperation in ace.ModelOperations)
          {
            if (aclOperation == modelOperation)
              return true;
          }
        }
      }

      return false;
	  }