12-07-2016 10:10 AM
Hi ,
In my site all user require Collaborative role actually its consumer , so i added a configuration like this
<permissionSet type="st:site" expose="selected">
<permissionGroup name="SiteManager" allowFullControl="true" expose="true" />
<permissionGroup name="SiteCollaborator" allowFullControl="false" expose="true">
<includePermissionGroup permissionGroup="Collaborator" type="cm:cmobject" />
</permissionGroup>
<permissionGroup name="SiteContributor" allowFullControl="false" expose="true">
<includePermissionGroup permissionGroup="Contributor" type="cm:cmobject" />
</permissionGroup>
<permissionGroup name="SiteConsumer" allowFullControl="false" expose="true">
<includePermissionGroup permissionGroup="Collaborator" type="cm:cmobject" />
</permissionGroup>
<permissionGroup name="SiteCommentator" allowFullControl="false" expose="true">
<includePermissionGroup permissionGroup="Consumer" type="cm:cmobject" />
<includePermissionGroup permissionGroup="ReadPermissions" type="sys:base" />
</permissionGroup>
</permissionSet>
in alfresco-community\tomcat\shared\classes\alfresco\extension\sitePermissionDefinitions.xml
but its still access denied for some operations.
or if there is any other way, please let me know with sample codes
Thank you
12-07-2016 02:55 PM
You also need to bootstrap your permission model ,please refer to http://docs.alfresco.com.cn/4.2/concepts/dev-extensions-modules-custom-permission-model.html
That means you need add an spring definition file in your alfresco-community\tomcat\shared\classes\alfresco\extension folder ,for example site-custom-context.xml and paste following content into your site-custom-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="siteService_permissionBootstrap" parent="permissionModelBootstrap">
<property name="model" value="sitePermissionDefinitions.xml"/>
</bean>
</beans>
12-08-2016 01:13 AM
thank you kayne,
i created site-custom-context.xml and place it in alfresco-community\tomcat\shared\classes\alfresco\extension\ and sitePermissionDefinitions.xml two files but its getting error
Exception calling (POST) http://localhost:8090/alfresco/s/remoteadm/update/alfresco/site-data/module-deployments/Aikau%201.0....
2016-12-08 09:59:41,674 INFO [org.springframework.extensions.webscripts.connector.RemoteClient] [http-apr-8090-exec-4] Error status 500 Connection reset
java.net.SocketException: Connection reset
or please provide sample code for how creating groups, assign user to group and giving permission to groups using restful api or cmis
12-08-2016 01:42 AM
ERROR [org.springframework.web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'siteService_permissionBootstrap' defined in file [D:\alfresco-community\tomcat\shared\classes\alfresco\extension\site-custom-context.xml]: Invocation of init method failed; nested exception is org.alfresco.repo.security.permissions.impl.model.PermissionModelException: 11080000 Failed to create permission model document: alfresco\extension\sitePermissionDefinitions.xml at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:672)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1859)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.alfresco.repo.security.permissions.impl.model.PermissionModelException: 11080000 Failed to create permission model document: alfresco\extension\sitePermissionDefinitions.xml
at org.alfresco.repo.security.permissions.impl.model.PermissionModel.createDocument(PermissionModel.java:1328)
at org.alfresco.repo.security.permissions.impl.model.PermissionModel.addPermissionModel(PermissionModel.java:1217)
at org.alfresco.repo.security.permissions.impl.model.PermissionModelBootstrap.init(PermissionModelBootstrap.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1640)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
... 26 more
Caused by: org.dom4j.DocumentException: Error on line 6 of document : Invalid byte 1 of 1-byte UTF-8 sequence. Nested exception: Invalid byte 1 of 1-byte UTF-8 sequence.
12-08-2016 02:10 AM
Finally I got succeed , thank you Kayne
12-09-2016 10:02 AM
How ? I have the same error
12-09-2016 11:13 AM
URL should be String apiurl1 = "http://127.0.0.1:8090/alfresco/s/api/sites/"+siteName+"/memberships";
instead of String String apiurl1 = "http://127.0.0.1:8090/alfresco/s/sites/"+siteName+"/memberships";
Please read webscript api document carefully
12-12-2016 02:41 AM
Thank you kayne, I reffered the api docs, and even though its getting same error
String apiurl1 = "http://127.0.0.1:8090/alfresco/s/api/sites/"+siteName+"/memberships";
PostMethod post1 = new PostMethod(apiurl1);
JSONObject body1 = new JSONObject();
body1.put("shortName", siteName);
body1.put("role", "Consumer");
body1.put("new role", "Collaborator");
body1.put("fullName", "GROUP_"+groupName);
post1.setDoAuthentication(true);
post1.setRequestHeader("Content-Type", "application/json");
post1.setRequestEntity(new StringRequestEntity(body1.toString(),"application/json", "UTF-8"));
int status1 = client.executeMethod(post1);
error :"Request sent by the client was syntactically incorrect."
12-12-2016 02:50 AM
According api docs fullName should be sub element of group which is sub element of root object.
So it should be like this
body.put("role", "SiteConsumer");
JSONObject group = new JSONObject();
group.put("fullName", "GROUP_kayne");
body.put("group", group);
12-12-2016 03:02 AM
Thank you kayne....
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.