Share via


Setting Custom Masks

Setting Custom Masks

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release. Setcustommasks.asp grants a user rights to access an item using a custom mask.

<%
// Sets custom masks on an existing entity of the DACL
function SetCustomMasks(user, itemURL).
{
    var objDacl = CreateSecurityDACL(SECURITY_ON_SERVER());

    // Load the security descriptor in dacl object.
    var objLoadResult = objDacl.Load(itemURL);
    if (objLoadResult.number != 0)
    {
          Response.Write("<b>Failed to Load: " + objLoadResult.description + "</b><br>");
        return(objLoadResult.number);   //error loading the object ...maybe the url does not exist....
    }

    //Get the entity object on which the masks need to be set
    var entityUser = objDacl.SearchForObjectByDisplayName(user);
    if (null==entityUser)
    {
          Response.Write("<b>Failed to Search for object by display name</b><br>");
       return(-1);   //maybe the user does not exist......
    }


    //Set the Custom Masks
    if(objDacl.isFolder){   //if the item is a folder, then do folder perms
      var daclWSFolderTemplate = DaclWebStorageFolder();  //dacl for Folder rights
      entityUser.SetByTemplate(daclTemplate, "WS Folder Create container");
      entityUser.SetByTemplate(daclTemplate, "WS Folder Write SD");
    }else{
      var daclTemplate = DaclWebStorageItem();   //dacl for Item rights
      entityUser.SetByTemplate(daclTemplate, "WS Read properties");
      entityUser.SetByTemplate(daclTemplate, "WS Write body");
    }

    //Save the DACL on the item
    objResult = objDacl.Save();
    if(objResult.number != 0)
    {
        Response.Write("<b>Failed to Save DACL: " + objResult.description + "</b><br>");
       return(objResult.number);
    }
    return(0);
}
%>



                     

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.