Show/Hide Toolbars

Therefore Programming Interface 3.0

 

This functions defines the rights a user has on a specific document. The rights can be set only by the Thereforeā„¢ Rights Server or can be set as a combination of rights from the Thereforeā„¢ Default Rights and the Thereforeā„¢ Rights Server Rights. This Function is called everytime the Thereforeā„¢ Viewer loads an Thereforeā„¢ Document.

 

public void GetDocRights([in] object vUser, [in] int nDocNo, [out] long pnRightsSrvMask, [out] long pnTheDBMask, [out] int pnDocStatus, [out] int pnCheckoutUserNo, [out] int pnCurDocNo)

 

Arguments

 

vUser

The User, who wants to archive a document (see User).

nDocNo

The Document Number to get the rights for.

pnRightsSrvMask

The Rights the user has for this document in regards of the rights server implementation. Can be combined with pnTheDBMask (see Remarks).        

pnTheDBMask

The Rights that should be used from Thereforeā„¢. Can be combined with pnRightsSrvMask (see Remarks).        

pnDocStatus

Set the current status of the document (see Document States).

pnCheckoutUserNo

The user number of the user that has the document currently checked out.

pnCurDocNo

         Deprecated. Set to 0.

Return

 

No Return Value.

 

Remarks

 

Additional Information about Rights:

Permission constants

 

Scenarios:

 

1) Ignore Thereforeā„¢ Rights and only use RightServer Rights:

 

If you want to ignore all Thereforeā„¢ Rights, set the pnTheDBMask = 0 and return the corresponding rights in pnRightsSrvMask. All Rights defined in Thereforeā„¢ will be ignored and the TheRightsServer rights are used.

 

2) Ignore RightServer Rights and only use Thereforeā„¢ Rights

 

 If you want to use only Thereforeā„¢ Defined Rights return pnRightsSrvMask = 0 and pnTheDBMask = 0xFFFFFFFF.

 

3) Overwrite specific rights, i.e. overwrite some Thereforeā„¢ Rights with TheRightsServer Rights

 

 If you want to only overwrite specific rights, set Grant or Revoke in pnRightsSrvMask and remove the Grant and Revoke from pnTheDBMask.

 

4) Combine rights from Thereforeā„¢ Rights Server with Default Thereforeā„¢ Rights (combine with AND)

 

a) If the Thereforeā„¢ Rights Server should combine a Grant with the Thereforeā„¢ Defined Rights, remove that right from pnRightsSrvMask and set that right in pnTheDBMask. This combined the Rights Server Permission with the Thereforeā„¢ Defined Permission and the user will only be able to do that action if both (Thereforeā„¢ Rights Server and Thereforeā„¢ Default Rights) agree.

 

b) If the Thereforeā„¢ Rights Server should combine a Revoke with the Thereforeā„¢ Defined Rights, remove that right from pnTheDBMask and set that right in pnRightsSrvMask.

 

5) Combine rights from Thereforeā„¢ Rights Server with Default Thereforeā„¢ Rights (combine with OR)

 

 If you want to combine rights from the Thereforeā„¢ Rights Server and default Thereforeā„¢ Defined Rights with OR, just set the Grant or Revoke in pnRightsSrvMask and set the pnTheDBMask to 0xFFFFFFFFFFFFFFFF.

 

 

C# Sample (Implementing the Function):

 

Scenario 1: Give the User the Right to View and Annotate the Document. Ignore Thereforeā„¢ Category Rights. Leave other values unchanged.

 

public void GetDocRights(object vUser, int nDocNo, long pnRightsSrvMask, long pnTheDBMask, int pnDocStatus, int pnCheckoutUserNo, int pnCurDocNo)

{

   pnTheDBMask = 0;

 

   pnRightsSrvMask = 0x00000001//Allow View

   pnRightsSrvMask &= 0x00000200 //Prohibit Index Data Update

   pnRightsSrvMask &= 0x00000100 //Allow Annotate

 

   pnDocStatus = 0;

   pnCheckoutUserNo = 0;

   pnCurDocNo = 0;

}

 

Scenario 2: Use only Thereforeā„¢ Rights

 

public void GetDocRights(object vUser, int nDocNo, int pnRightsSrvMask, int pnTheDBMask, int pnDocStatus, int pnCheckoutUserNo, int pnCurDocNo)

{

   unchecked

   {

      pnTheDBMask = (long)0xFFFFFFFFFFFFFFFF;   //initialize the pnTheDBMask

   }

 

   pnRightsSrvMask = 0

   pnDocStatus = 0;

   pnCheckoutUserNo = 0;

   pnCurDocNo = 0;

}

 

Scenario 3: Give User View and Annotation Rights. For all other permissions, use Thereforeā„¢ Defined Rights.

 

public void GetDocRights(object vUser, int nDocNo, int pnRightsSrvMask, int pnTheDBMask, int pnDocStatus, int pnCheckoutUserNo, int pnCurDocNo)

{

   pnRightsSrvMask = 0x00000001;   //Allow View in pnRightsSrvMask 

       pnRightsSrvMask += 0x00000200;  //Prohibit Annotations in pnRightsSrvMask

 

       unchecked

       {

          pnTheDBMask = (long)0xFFFFFFFFFFFFFFFF;   //initialize the pnTheDBMask

       }

 

       pnTheDBMask -= 0x00000001;      //Remove Allow View

       pnTheDBMask -= 0x00000002;      //Remove Prohibit View

       pnTheDBMask -= 0x00000100;      //Remove Allow Annotations

       pnTheDBMask -= 0x00000200;      //Remove Prohibit Annotations

            

   pnDocStatus = 0;

   pnCheckoutUserNo = 0;

   pnCurDocNo = 0;

}

 

Scenario 4b: Binary negate permissions.

 

pnTheDBMask = ~pnTheRightsSrvMask;

 

Scenario 5: Give User View and Annotation Rights and combine that with the Thereforeā„¢ Default Rights using OR.

 

public void GetDocRights(object vUser, int nDocNo, int pnRightsSrvMask, int pnTheDBMask, int pnDocStatus, int pnCheckoutUserNo, int pnCurDocNo)

{

   pnRightsSrvMask = 0x00000001;   //Allow View in pnRightsSrvMask 

       pnRightsSrvMask += 0x00000200;  //Prohibit Annotations in pnRightsSrvMask

 

       unchecked

       {

          pnTheDBMask = (long)0xFFFFFFFFFFFFFFFF;   //initialize the pnTheDBMask

       }

            

   pnDocStatus = 0;

   pnCheckoutUserNo = 0;

   pnCurDocNo = 0;

}

 

C# Sample (Function not implemented - Use default Thereforeā„¢ Rights and don't call again):

public int AllowDelete(object vUser, int nDocNo)

{

   throw new NotImplementedException();

}

 

See also:

Additional Information about vUser Object

Ā© 2024 Therefore Corporation, all rights reserved.