Checking the known rights against the principal's rights

Once you have the ObjectPrincipal for the user (see Viewing a user's rights on an object), you can start to check the user's rights for the object. To do this, you must iterate through all of the object's known rights and check them against the user's rights. The following function illustrates the retrieval of the explicit rights that the user has. It starts to build a table that indicates all the user's explicit rights, and later, the net rights too.


function GetAllRights()

{

    var HTML = "";

    

    HTML += "<table border=1 cellpadding=3><TR align=left>";

    HTML += "<TH colspan=1></TH><TH colspan=3>Explicit Rights</TH><TH colspan=1></TH><TH colspan=1></TH></TR>";

    HTML += "<TR align=left><TH>Inherited Rights</TH>";

    HTML += "<TH>Granted</TH><TH>Denied</TH>";

    HTML += "<TH>Not Specified</TH><TH>Net Right</TH><TH>Right</TH></TR>";

    


    var result = new Array();

    for (k=1;k<=KnownRights.Count;k++)

    {

        Right = KnownRights.Item(k)

        HTML += "<TR>"

        Granted=""

        Denied=""

        Inherited=""

        NotSpecified=""


This example basically displays three radio buttons that indicate how the right has been set: granted, denied, or not specified. Note that when the principal right is retrieved it may fail. If it does, this indicates that the right has not been specified. You'll use this information later to help determine the net right of the object.

Go to the next section: Determining the user's net rights.



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com