Dear Friends ,
I would like to assign specific permissions on a document to specific users using JAVA API's.
I have a document "mytest.doc" i want to make this document invisible from all the users except 2 other users.
I tried to revoke all the permissions there are no errors thrown from the java code, but it does not revoke the permission.
Also could someone please tell me how to assing permissions to a specific user.
below is my code please tell me where am i going wrong.
public void changePermissions(int iDocID)
{
LAPI_DOCUMENTS doc;
LLValue entInfo = (new LLValue()).setAssocNotSet();
doc = new LAPI_DOCUMENTS(llSession);
if(0 != doc.AccessEnterpriseWS(entInfo) )
{
System.out.println("AccessEnterpriseWS Failed.");
return ;
}
int volumeID = entInfo.toInteger("VolumeID");
LLValue objInfo = new LLValue();
doc.GetObjectInfo(volumeID , iDocID,objInfo);
System.out.println(" Status .... " +objInfo.toString("STATUS"));
objInfo = new LLValue();
doc.GetObjectRights(volumeID , iDocID,objInfo);
doc.SetObjectRight(volumeID , iDocID,LAPI_DOCUMENTS.RIGHT_DELETE,LAPI_DOCUMENTS.RIGHT_GROUP,LAPI_DOCUMENTS.PERM_FULL,0);
System.out.println(" Error Message After Removing Groups Permissions.. "+ llSession.getErrMsg());
System.out.println(" Status Message .. "+ llSession.getStatusMessage());
doc.SetObjectRight(volumeID , iDocID,LAPI_DOCUMENTS.RIGHT_DELETE,LAPI_DOCUMENTS.RIGHT_OWNER,LAPI_DOCUMENTS.PERM_FULL,0);
System.out.println(" Error Message After Removing Owners Permissions .. "+ llSession.getErrMsg());
System.out.println(" Status Message .. "+ llSession.getStatusMessage());
doc.SetObjectRight(volumeID , iDocID,LAPI_DOCUMENTS.RIGHT_DELETE,LAPI_DOCUMENTS.RIGHT_SYSTEM,LAPI_DOCUMENTS.PERM_FULL,0);
System.out.println(" Error Message After Removing System Permissions.. "+ llSession.getErrMsg());
System.out.println(" Status Message .. "+ llSession.getStatusMessage());
}
I would like to assign specific permissions on a document to specific users using JAVA API's.
I have a document "mytest.doc" i want to make this document invisible from all the users except 2 other users.
I tried to revoke all the permissions there are no errors thrown from the java code, but it does not revoke the permission.
Also could someone please tell me how to assing permissions to a specific user.
below is my code please tell me where am i going wrong.
public void changePermissions(int iDocID)
{
LAPI_DOCUMENTS doc;
LLValue entInfo = (new LLValue()).setAssocNotSet();
doc = new LAPI_DOCUMENTS(llSession);
if(0 != doc.AccessEnterpriseWS(entInfo) )
{
System.out.println("AccessEnterpriseWS Failed.");
return ;
}
int volumeID = entInfo.toInteger("VolumeID");
LLValue objInfo = new LLValue();
doc.GetObjectInfo(volumeID , iDocID,objInfo);
System.out.println(" Status .... " +objInfo.toString("STATUS"));
objInfo = new LLValue();
doc.GetObjectRights(volumeID , iDocID,objInfo);
doc.SetObjectRight(volumeID , iDocID,LAPI_DOCUMENTS.RIGHT_DELETE,LAPI_DOCUMENTS.RIGHT_GROUP,LAPI_DOCUMENTS.PERM_FULL,0);
System.out.println(" Error Message After Removing Groups Permissions.. "+ llSession.getErrMsg());
System.out.println(" Status Message .. "+ llSession.getStatusMessage());
doc.SetObjectRight(volumeID , iDocID,LAPI_DOCUMENTS.RIGHT_DELETE,LAPI_DOCUMENTS.RIGHT_OWNER,LAPI_DOCUMENTS.PERM_FULL,0);
System.out.println(" Error Message After Removing Owners Permissions .. "+ llSession.getErrMsg());
System.out.println(" Status Message .. "+ llSession.getStatusMessage());
doc.SetObjectRight(volumeID , iDocID,LAPI_DOCUMENTS.RIGHT_DELETE,LAPI_DOCUMENTS.RIGHT_SYSTEM,LAPI_DOCUMENTS.PERM_FULL,0);
System.out.println(" Error Message After Removing System Permissions.. "+ llSession.getErrMsg());
System.out.println(" Status Message .. "+ llSession.getStatusMessage());
}