GetDocRights |
Scroll |
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] int pnRightsSrvMask, [out] int 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:
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 0xFFFFFFFF.
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, int pnRightsSrvMask, int 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 = (int)0xFFFFFFFF; //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 = (int)0xFFFFFFFF; //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 4a,b) no samples available.
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 = (int)0xFFFFFFFF; //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: