• Permissions API

  • Do you want to create a native client or integrate with third party applications: webservices are the solution.
Do you want to create a native client or integrate with third party applications: webservices are the solution.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #13143  by mindaugas
 
I have been looking for a API (web service) to edit or add new file or folder permissions in an openKM, but as far I have been looking there are none. Can you point me how to manage file or folder permissions?
 #13497  by Linsche
 
Hi

I also have some problems with permissions. I Just made a simple sample in PHP
Code: Select all
$OKMAuth = new SoapClient($DMS_URL."/OpenKM/OKMAuth?wsdl");
$folderRequest = new SoapClient($DMS_URL."/OpenKM/OKMFolder?wsdl");

$token = $OKMAuth->login('MyUser', 'MyPass');

$OKMAuth->grantRole($token, '/okm:root/DAI/Marken/1/Test/', 'TMO', 15, false) ;

$roles = $OKMAuth->getGrantedRoles($token, '/okm:root/DAI/Marken/1/Test/'); 

$OKMAuth->logout($token);

var_dump($roles);
The path exists, the role exists and I can add the role to the folder with the OpenKM webinterface but the script is throwing this error:
Code: Select all
Fatal error: Uncaught SoapFault exception: [env:Server] java.lang.NullPointerException in /var/www/vhosts/srepweb132/data/html/dms/dms_test.php:20 Stack trace: #0 [internal function]: SoapClient->__call('grantRole', Array) #1 /var/www/vhosts/srepweb132/data/html/dms/dms_test.php(20): SoapClient->grantRole('107636643987133...', '/okm:root/DAI/M...', 'TMO', 15, false) #2 {main} 
I also tried different combinations of parameters without beeing successfull.

Thank you for helping!
 #13509  by pavila
 
Any error in the server.log file?

BTW, do no put slash / at the end of the path.
 #13550  by Linsche
 
Hi

there is just
Code: Select all
2012-01-18 14:13:07,510 ERROR [org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS] SOAP request exception
java.lang.NullPointerException
	at org.apache.jackrabbit.core.NodeImpl.resolveRelativePropertyPath(NodeImpl.java:174)
	at org.apache.jackrabbit.core.NodeImpl.getProperty(NodeImpl.java:2828)
	at com.openkm.module.direct.DirectAuthModule.grantRole(DirectAuthModule.java:447)
	at com.openkm.module.direct.DirectAuthModule.grantRole(DirectAuthModule.java:417)
	at com.openkm.ws.endpoint.OKMAuth.grantRole(OKMAuth.java:155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.wsf.container.jboss42.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:102)
	at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:221)
	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:466)
	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
	at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
	at java.lang.Thread.run(Thread.java:662)
 #13557  by pavila
 
Permissions are defined as:
Code: Select all
public static final int READ = 1;
public static final int WRITE = 2;
public static final int DELETE = 4;
public static final int SECURITY = 8;
You can't use 15 as a permission parameter in a grant or revoke method. You have to do it for every individual permission, I mean in this case:

- grantRole for 1 (READ)
- grantRole for 2 (WRITE)
- grantRole for 4 (DELETE)
- grantRole for 8 (SECURITY)
 #16813  by bharatjangid
 
I am trying to get permissions(Read-Write-Delete) on the folder using OKMAuth but the method getGrantedUsers returns key as "okmAdmin" and value as "15", even I already added more roles and users; also managed permissions to individual. Is any other way to get granted permission?
 #16832  by jllort
 
any user with AdminRole will get allways on any node all permisions ( that's value 15 ). AdminRole indicates to the system that this kind of users will have full control with independence of what you have defined in security nodes.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.