Page 1 of 1

Permissions API

PostPosted:Thu Dec 08, 2011 1:24 pm
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?

Re: Permissions API

PostPosted:Sat Dec 10, 2011 8:16 am
by jllort
Take a look here http://wiki.openkm.com/index.php/OKMAuth

grantUser, revokeUser etc...

Re: Permissions API

PostPosted:Wed Jan 11, 2012 12:10 pm
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!

Re: Permissions API

PostPosted:Thu Jan 12, 2012 7:19 pm
by pavila
Any error in the server.log file?

BTW, do no put slash / at the end of the path.

Re: Permissions API

PostPosted:Wed Jan 18, 2012 1:30 pm
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)

Re: Permissions API

PostPosted:Wed Jan 18, 2012 5:10 pm
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)

Re: Permissions API

PostPosted:Thu Jan 19, 2012 8:02 am
by Linsche
Thats it. Thank You!

Re: Permissions API

PostPosted:Thu Jun 07, 2012 12:00 pm
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?

Re: Permissions API

PostPosted:Sat Jun 09, 2012 6:02 am
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.