Was this helpful?
User Permissions
The methods listed on this page allow ACL operations for the user entity.
Note: The following imports are required for all of the Java code examples on this page.
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import com.pervasive.datacloud2.schema.api.acl.v1.ACLService;
import com.pervasive.datacloud2.schema.api.acl.v1.ACLServicePortBindingStub;
import com.pervasive.datacloud2.schema.api.acl.v1.ACLServiceService;
import com.pervasive.datacloud2.schema.api.acl.v1.ACLServiceServiceLocator;
import com.pervasive.datacloud2.schema.api.acl.v1.InvalidSessionException;
import com.pervasive.datacloud2.schema.api.acl.v1.Action;
Tip...  Use the Entity API Service login method to start a session and obtain the sessionId parameter required for the ACL Service API methods. See Login and Logout.
setUserPermission
Sets access permission for a user to access another user.
Parameters
 
Name
Type
Description
Required?
id
Long
ID of the user to be accessed.
Yes.
user
Long
ID of the user to be granted access.
Yes.
permission
String
Permission to set.
Yes.
sessionId
String
ID of the current user session.
Yes.
Example
SOAP Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://datacloud2.pervasive.com/schema/api/acl/v1/">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:setUserPermission>
         <id>173</id>
         <user>171</user>
         <permission>READ</permission>
         <sessionId>70c84502-e6d2-4c4b-b3a9-a74c6f8a5ff9</sessionId>
      </v1:setUserPermission>
   </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:setUserPermissionResponse xmlns:ns2="http://datacloud2.pervasive.com/schema/api/acl/v1/" xmlns:ns3="http://datasolutions.pervasive.com/api/crud"/>
   </S:Body>
</S:Envelope>
Java Code Sample
final long id = 173;
final long user = 171;
final String permission = "READ";
final String sessionId = "70c84502-e6d2-4c4b-b3a9-a74c6f8a5ff9";
ACLServiceServiceLocator service = new ACLServiceServiceLocator();
ACLService stub = service.getACLServicePort();
stub.setUserPermission(id, user, permission, sessionId);
getUserACL
List the access permissions attached to a user entity.
Parameters
 
Name
Type
Description
Required?
id
Long
ID of the user.
Yes.
sessionId
String
ID of the current user session.
Yes.
Returns
 
Name
Type
Description
ACLPermisssions
ACLProxy
List of ACL entries attached to the specified user.
Example
SOAP Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://datacloud2.pervasive.com/schema/api/acl/v1/">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:getUserACL>
         <id>171</id>
         <sessionId>70c84502-e6d2-4c4b-b3a9-a74c6f8a5ff9</sessionId>
      </v1:getUserACL>
   </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:getUserACLResponse xmlns:ns2="http://datacloud2.pervasive.com/schema/api/acl/v1/" xmlns:ns3="http://datasolutions.pervasive.com/api/crud">
         <return>
            <ns2:entry user="171">
               <ns2:permission>READ</ns2:permission>
            </ns2:entry>
         </return>
      </ns2:getUserACLResponse>
   </S:Body>
</S:Envelope>
Java Code Sample
final long id = 173;
final String sessionId = "70c84502-e6d2-4c4b-b3a9-a74c6f8a5ff9";
ACLServiceServiceLocator service = new ACLServiceServiceLocator();
ACLService stub = service.getACLServicePort();
String userValue[][] = stub.getUserACL(id, sessionId);
hasAccessToUser
Checks whether a user has specified access permissions for a designated user entity.
Parameters
 
Name
Type
Description
Required?
verb
Action
Access permission to check.
Yes.
id
Long
ID of the user.
Yes.
sessionId
String
ID of the current user session.
Yes.
Returns
 
Name
Type
Description
Permission State
Boolean
Returns true if the user has the specified permission.
Example
SOAP Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://datacloud2.pervasive.com/schema/api/acl/v1/">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:hasAccessToUser>
         <verb>READ</verb>
         <userId>171</userId>
         <sessionId>70c84502-e6d2-4c4b-b3a9-a74c6f8a5ff9</sessionId>
      </v1:hasAccessToUser>
   </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:hasAccessToUserResponse xmlns:ns2="http://datacloud2.pervasive.com/schema/api/acl/v1/" xmlns:ns3="http://datasolutions.pervasive.com/api/crud">
         <return>true</return>
      </ns2:hasAccessToUserResponse>
   </S:Body>
</S:Envelope>
Java Code Sample
final String verb = "READ";
final long id = 173;
final String sessionId = "70c84502-e6d2-4c4b-b3a9-a74c6f8a5ff9";
ACLServiceServiceLocator service = new ACLServiceServiceLocator();
ACLService stub = service.getACLServicePort();
Boolean userAccess = stub.hasAccessToUser(Action.fromString(verb), id, sessionId);
clearUserPermission
Remove the specified user access permission from the designated user.
Parameters
 
Name
Type
Description
Required?
id
Long
ID of the target user.
Yes.
user
Long
ID of the user whose permissions are being removed.
Yes.
permission
String
Permission to clear.
Yes.
sessionId
String
ID of the current user session.
Yes.
Example
SOAP Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://datacloud2.pervasive.com/schema/api/acl/v1/">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:clearUserPermission>
         <id>173</id>
         <user>171</user>
         <permission>READ</permission>
         <sessionId>70c84502-e6d2-4c4b-b3a9-a74c6f8a5ff9</sessionId>
      </v1:clearUserPermission>
   </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:clearUserPermissionResponse xmlns:ns2="http://datacloud2.pervasive.com/schema/api/acl/v1/" xmlns:ns3="http://datasolutions.pervasive.com/api/crud"/>
   </S:Body>
</S:Envelope>
Java Code Sample
final long id = 173;
final long user = 171;
final String permission = "READ";
final String sessionId = "70c84502-e6d2-4c4b-b3a9-a74c6f8a5ff9";
ACLServiceServiceLocator service = new ACLServiceServiceLocator();
ACLService stub = service.getACLServicePort();
stub.clearUserPermission(id, user, permission, sessionId);
Last modified date: 12/17/2021