mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
AW-542 Guest user can not see any Categories
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2456 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -52,10 +52,6 @@
|
|||||||
<bean id="spacesBootstrap" parent="spacesStoreImporter">
|
<bean id="spacesBootstrap" parent="spacesStoreImporter">
|
||||||
<property name="bootstrapViews">
|
<property name="bootstrapViews">
|
||||||
<list>
|
<list>
|
||||||
<props>
|
|
||||||
<prop key="path">/</prop>
|
|
||||||
<prop key="location">alfresco/bootstrap/categories.xml</prop>
|
|
||||||
</props>
|
|
||||||
<props>
|
<props>
|
||||||
<prop key="path">/</prop>
|
<prop key="path">/</prop>
|
||||||
<prop key="location">alfresco/bootstrap/spaces.xml</prop>
|
<prop key="location">alfresco/bootstrap/spaces.xml</prop>
|
||||||
@@ -65,6 +61,10 @@
|
|||||||
<prop key="path">/</prop>
|
<prop key="path">/</prop>
|
||||||
<prop key="location">alfresco/bootstrap/system.xml</prop>
|
<prop key="location">alfresco/bootstrap/system.xml</prop>
|
||||||
</props>
|
</props>
|
||||||
|
<props>
|
||||||
|
<prop key="path">/</prop>
|
||||||
|
<prop key="location">alfresco/bootstrap/categories.xml</prop>
|
||||||
|
</props>
|
||||||
<props>
|
<props>
|
||||||
<prop key="path">/${spaces.company_home.childname}/${spaces.guest_home.childname}</prop>
|
<prop key="path">/${spaces.company_home.childname}/${spaces.guest_home.childname}</prop>
|
||||||
<prop key="location">alfresco/bootstrap/tutorial.xml</prop>
|
<prop key="location">alfresco/bootstrap/tutorial.xml</prop>
|
||||||
@@ -83,6 +83,11 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<bean id="versionBootstrap" parent="versionStoreImporter">
|
||||||
|
</bean>
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- Descriptor Service -->
|
<!-- Descriptor Service -->
|
||||||
|
|
||||||
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl">
|
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl">
|
||||||
|
@@ -2,6 +2,12 @@
|
|||||||
xmlns:cm="http://www.alfresco.org/model/content/1.0">
|
xmlns:cm="http://www.alfresco.org/model/content/1.0">
|
||||||
|
|
||||||
<cm:category_root view:childName="cm:categoryRoot">
|
<cm:category_root view:childName="cm:categoryRoot">
|
||||||
|
<view:acl>
|
||||||
|
<view:ace view:access="ALLOWED">
|
||||||
|
<view:authority>guest</view:authority>
|
||||||
|
<view:permission>Read</view:permission>
|
||||||
|
</view:ace>
|
||||||
|
</view:acl>
|
||||||
<cm:name>categories</cm:name>
|
<cm:name>categories</cm:name>
|
||||||
<cm:categories>
|
<cm:categories>
|
||||||
|
|
||||||
|
@@ -2,13 +2,13 @@
|
|||||||
xmlns:cm="http://www.alfresco.org/model/content/1.0"
|
xmlns:cm="http://www.alfresco.org/model/content/1.0"
|
||||||
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
||||||
|
|
||||||
<!-- NOTE: all replaced properties referenced from repository.properties file must also be
|
<!-- NOTE: all replaced properties referenced from repository.properties file must also be
|
||||||
mapped in the bootstrap-context.xml spacesBootstrap/configuration section -->
|
mapped in the bootstrap-context.xml spacesBootstrap/configuration section -->
|
||||||
<cm:folder view:childName="${spaces.company_home.childname}">
|
<cm:folder view:childName="${spaces.company_home.childname}">
|
||||||
<view:acl view:inherit="false">
|
<view:acl view:inherit="false">
|
||||||
<view:ace view:access="ALLOWED">
|
<view:ace view:access="ALLOWED">
|
||||||
<view:authority>GROUP_EVERYONE</view:authority>
|
<view:authority>GROUP_EVERYONE</view:authority>
|
||||||
<view:permission>Guest</view:permission>
|
<view:permission>Consumer</view:permission>
|
||||||
</view:ace>
|
</view:ace>
|
||||||
</view:acl>
|
</view:acl>
|
||||||
<app:uifacets />
|
<app:uifacets />
|
||||||
@@ -39,12 +39,12 @@
|
|||||||
<cm:description>${spaces.templates.content.description}</cm:description>
|
<cm:description>${spaces.templates.content.description}</cm:description>
|
||||||
</cm:folder>
|
</cm:folder>
|
||||||
<cm:folder view:childName="${spaces.savedsearches.childname}">
|
<cm:folder view:childName="${spaces.savedsearches.childname}">
|
||||||
<view:acl view:inherit="false">
|
<view:acl view:inherit="false">
|
||||||
<view:ace view:access="ALLOWED">
|
<view:ace view:access="ALLOWED">
|
||||||
<view:authority>GROUP_EVERYONE</view:authority>
|
<view:authority>GROUP_EVERYONE</view:authority>
|
||||||
<view:permission>Contributor</view:permission>
|
<view:permission>Contributor</view:permission>
|
||||||
</view:ace>
|
</view:ace>
|
||||||
</view:acl>
|
</view:acl>
|
||||||
<app:uifacets />
|
<app:uifacets />
|
||||||
<cm:name>${spaces.savedsearches.name}</cm:name>
|
<cm:name>${spaces.savedsearches.name}</cm:name>
|
||||||
<app:icon>space-icon-default</app:icon>
|
<app:icon>space-icon-default</app:icon>
|
||||||
@@ -57,11 +57,11 @@
|
|||||||
<view:acl view:inherit="false">
|
<view:acl view:inherit="false">
|
||||||
<view:ace view:access="ALLOWED">
|
<view:ace view:access="ALLOWED">
|
||||||
<view:authority>guest</view:authority>
|
<view:authority>guest</view:authority>
|
||||||
<view:permission>Guest</view:permission>
|
<view:permission>Consumer</view:permission>
|
||||||
</view:ace>
|
</view:ace>
|
||||||
<view:ace view:access="ALLOWED">
|
<view:ace view:access="ALLOWED">
|
||||||
<view:authority>GROUP_EVERYONE</view:authority>
|
<view:authority>GROUP_EVERYONE</view:authority>
|
||||||
<view:permission>Guest</view:permission>
|
<view:permission>Consumer</view:permission>
|
||||||
</view:ace>
|
</view:ace>
|
||||||
</view:acl>
|
</view:acl>
|
||||||
<app:uifacets />
|
<app:uifacets />
|
||||||
|
@@ -2,7 +2,17 @@
|
|||||||
xmlns:cm="http://www.alfresco.org/model/content/1.0"
|
xmlns:cm="http://www.alfresco.org/model/content/1.0"
|
||||||
xmlns:sys="http://www.alfresco.org/model/system/1.0"
|
xmlns:sys="http://www.alfresco.org/model/system/1.0"
|
||||||
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
xmlns:app="http://www.alfresco.org/model/application/1.0">
|
||||||
|
|
||||||
|
<view:reference view:pathref="${bootstrap.location.path}">
|
||||||
|
<!-- Apply Read access to Everyone on root node of Spaces Store -->
|
||||||
|
<view:acl>
|
||||||
|
<view:ace view:access="ALLOWED">
|
||||||
|
<view:authority>GROUP_EVERYONE</view:authority>
|
||||||
|
<view:permission>Read</view:permission>
|
||||||
|
</view:ace>
|
||||||
|
</view:acl>
|
||||||
|
</view:reference>
|
||||||
|
|
||||||
<sys:container view:childName="${system.system_container.childname}">
|
<sys:container view:childName="${system.system_container.childname}">
|
||||||
<sys:children>
|
<sys:children>
|
||||||
<sys:container view:childName="${system.people_container.childname}">
|
<sys:container view:childName="${system.people_container.childname}">
|
||||||
@@ -15,12 +25,12 @@
|
|||||||
<cm:organizationId></cm:organizationId>
|
<cm:organizationId></cm:organizationId>
|
||||||
<cm:homeFolder>/${spaces.company_home.childname}</cm:homeFolder>
|
<cm:homeFolder>/${spaces.company_home.childname}</cm:homeFolder>
|
||||||
</cm:person>
|
</cm:person>
|
||||||
<!-- Guest needs to read their own home space -->
|
<!-- Guest needs to read their own person information -->
|
||||||
<cm:person view:childName="cm:person">
|
<cm:person view:childName="cm:person">
|
||||||
<view:acl view:inherit="false">
|
<view:acl view:inherit="false">
|
||||||
<view:ace view:access="ALLOWED">
|
<view:ace view:access="ALLOWED">
|
||||||
<view:authority>guest</view:authority>
|
<view:authority>guest</view:authority>
|
||||||
<view:permission>Guest</view:permission>
|
<view:permission>Read</view:permission>
|
||||||
</view:ace>
|
</view:ace>
|
||||||
</view:acl>
|
</view:acl>
|
||||||
<cm:userName>guest</cm:userName>
|
<cm:userName>guest</cm:userName>
|
||||||
|
@@ -645,6 +645,9 @@
|
|||||||
<property name="authorityService">
|
<property name="authorityService">
|
||||||
<ref bean="AuthorityService" />
|
<ref bean="AuthorityService" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="authenticationService">
|
||||||
|
<ref bean="AuthenticationService" />
|
||||||
|
</property>
|
||||||
<property name="viewParser">
|
<property name="viewParser">
|
||||||
<ref bean="viewParser" />
|
<ref bean="viewParser" />
|
||||||
</property>
|
</property>
|
||||||
@@ -734,6 +737,12 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="versionStoreImporter" parent="storeImporter" abstract="true">
|
||||||
|
<property name="storeUrl">
|
||||||
|
<value>workspace://lightWeightVersionStore</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- Exporters -->
|
<!-- Exporters -->
|
||||||
<bean id="exporterComponent" class="org.alfresco.repo.exporter.ExporterComponent">
|
<bean id="exporterComponent" class="org.alfresco.repo.exporter.ExporterComponent">
|
||||||
<property name="namespaceService">
|
<property name="namespaceService">
|
||||||
|
@@ -24,3 +24,16 @@ patch.guestUser.result=Added guest user and fixed permissions.
|
|||||||
|
|
||||||
patch.fixNodeSerializableValues.description=Ensure that property values are not stored as Serializable if at all possible
|
patch.fixNodeSerializableValues.description=Ensure that property values are not stored as Serializable if at all possible
|
||||||
patch.fixNodeSerializableValues.result=Fixed {0} node property serialized values
|
patch.fixNodeSerializableValues.result=Fixed {0} node property serialized values
|
||||||
|
|
||||||
|
patch.updateGuestPermission.description=Rename guest permission from 'Guest' to 'Consumer'
|
||||||
|
patch.updateGuestPermission.result=Created the following permission reference names: {0}. \nUpdated {1} permission entries.
|
||||||
|
|
||||||
|
patch.categoryRootPermission.description=Sets required permissions on 'Category Root' folder.
|
||||||
|
patch.categoryRootPermission.result=Granted CONSUMER role to GUEST on ''Category Root'' folder: {0}.
|
||||||
|
patch.categoryRootPermission.err.not_found='Category Root' folder ({0}) could not be found.
|
||||||
|
|
||||||
|
patch.guestPersonPermission.description=Change Guest Person permission from 'Consumer' to 'Read'
|
||||||
|
patch.guestPersonPermission.result=Updated Guest Person permission from 'Consumer' to 'Read'
|
||||||
|
|
||||||
|
patch.spacesRootPermission.description=Change Spaces store root permission from 'Consumer' to 'Read'
|
||||||
|
patch.spacesRootPermission.result=Updated Spaces store root permission from 'Consumer' to 'Read'
|
||||||
|
@@ -233,9 +233,9 @@
|
|||||||
<!-- A contributor can create content and then they have full permission on what -->
|
<!-- A contributor can create content and then they have full permission on what -->
|
||||||
<!-- they have created - via the permissions assigned to the owner. -->
|
<!-- they have created - via the permissions assigned to the owner. -->
|
||||||
<permissionGroup name="Contributor" allowFullControl="false" expose="true" >
|
<permissionGroup name="Contributor" allowFullControl="false" expose="true" >
|
||||||
<!-- Contributor is a guest who can add content, and then can modify via the -->
|
<!-- Contributor is a consumer who can add content, and then can modify via the -->
|
||||||
<!-- owner permissions. -->
|
<!-- owner permissions. -->
|
||||||
<includePermissionGroup permissionGroup="Guest" type="cm:cmobject"/>
|
<includePermissionGroup permissionGroup="Consumer" type="cm:cmobject"/>
|
||||||
<includePermissionGroup permissionGroup="AddChildren" type="sys:base"/>
|
<includePermissionGroup permissionGroup="AddChildren" type="sys:base"/>
|
||||||
<!-- Check out requires write permissions so this will not apply to all -->
|
<!-- Check out requires write permissions so this will not apply to all -->
|
||||||
<!-- documents. -->
|
<!-- documents. -->
|
||||||
@@ -246,13 +246,13 @@
|
|||||||
<!-- new nodes. They can cehck out content into a space to which they have -->
|
<!-- new nodes. They can cehck out content into a space to which they have -->
|
||||||
<!-- create permission. -->
|
<!-- create permission. -->
|
||||||
<permissionGroup name="Editor" expose="true" allowFullControl="false" >
|
<permissionGroup name="Editor" expose="true" allowFullControl="false" >
|
||||||
<includePermissionGroup type="cm:cmobject" permissionGroup="Guest"/>
|
<includePermissionGroup type="cm:cmobject" permissionGroup="Consumer"/>
|
||||||
<includePermissionGroup type="sys:base" permissionGroup="Write"/>
|
<includePermissionGroup type="sys:base" permissionGroup="Write"/>
|
||||||
<includePermissionGroup type="cm:lockable" permissionGroup="CheckOut"/>
|
<includePermissionGroup type="cm:lockable" permissionGroup="CheckOut"/>
|
||||||
</permissionGroup>
|
</permissionGroup>
|
||||||
|
|
||||||
<!-- The guest permission allows read to everything by default. -->
|
<!-- The Consumer permission allows read to everything by default. -->
|
||||||
<permissionGroup name="Guest" allowFullControl="false" expose="true" >
|
<permissionGroup name="Consumer" allowFullControl="false" expose="true" >
|
||||||
<includePermissionGroup permissionGroup="Read" type="sys:base" />
|
<includePermissionGroup permissionGroup="Read" type="sys:base" />
|
||||||
</permissionGroup>
|
</permissionGroup>
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@
|
|||||||
<permissionGroup name="Collaborator" extends="true" expose="true"/>
|
<permissionGroup name="Collaborator" extends="true" expose="true"/>
|
||||||
<permissionGroup name="Contributor" extends="true" expose="true"/>
|
<permissionGroup name="Contributor" extends="true" expose="true"/>
|
||||||
<permissionGroup name="Editor" extends="true" expose="true"/>
|
<permissionGroup name="Editor" extends="true" expose="true"/>
|
||||||
<permissionGroup name="Guest" extends="true" expose="true"/>
|
<permissionGroup name="Consumer" extends="true" expose="true"/>
|
||||||
|
|
||||||
</permissionSet>
|
</permissionSet>
|
||||||
|
|
||||||
|
@@ -184,5 +184,86 @@
|
|||||||
<ref bean="sessionFactory" />
|
<ref bean="sessionFactory" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
<bean id="patch.updateGuestPermission" class="org.alfresco.repo.admin.patch.impl.UpdateGuestPermissionPatch" parent="basePatch" >
|
||||||
|
<property name="id"><value>patch.updateGuestPermission</value></property>
|
||||||
|
<property name="description"><value>patch.updateGuestPermission.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>5</value></property>
|
||||||
|
<property name="targetSchema"><value>6</value></property>
|
||||||
|
<!-- helper beans -->
|
||||||
|
<property name="sessionFactory">
|
||||||
|
<ref bean="sessionFactory"/>
|
||||||
|
</property>
|
||||||
|
<property name="dependsOn">
|
||||||
|
<list>
|
||||||
|
<ref bean="patch.guestUser"/>
|
||||||
|
<ref bean="patch.updatePermissionData"/>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
<bean id="patch.guestPersonPermission" class="org.alfresco.repo.admin.patch.impl.GuestPersonPermissionPatch" parent="basePatch" >
|
||||||
|
<property name="id"><value>patch.guestPersonPermission</value></property>
|
||||||
|
<property name="description"><value>patch.guestPersonPermission.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>5</value></property>
|
||||||
|
<property name="targetSchema"><value>6</value></property>
|
||||||
|
<!-- helper beans for execution -->
|
||||||
|
<property name="permissionService">
|
||||||
|
<ref bean="permissionService"/>
|
||||||
|
</property>
|
||||||
|
<property name="personService">
|
||||||
|
<ref bean="personService"/>
|
||||||
|
</property>
|
||||||
|
<property name="dependsOn">
|
||||||
|
<list>
|
||||||
|
<ref bean="patch.updateGuestPermission" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
<bean id="patch.spacesRootPermission" class="org.alfresco.repo.admin.patch.impl.SpacesRootPermissionPatch" parent="basePatch" >
|
||||||
|
<property name="id"><value>patch.spacesRootPermission</value></property>
|
||||||
|
<property name="description"><value>patch.spacesRootPermission.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>5</value></property>
|
||||||
|
<property name="targetSchema"><value>6</value></property>
|
||||||
|
<!-- helper beans for execution -->
|
||||||
|
<property name="spacesBootstrap">
|
||||||
|
<ref bean="spacesBootstrap" />
|
||||||
|
</property>
|
||||||
|
<property name="permissionService">
|
||||||
|
<ref bean="permissionService"/>
|
||||||
|
</property>
|
||||||
|
<property name="nodeService">
|
||||||
|
<ref bean="nodeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="dependsOn">
|
||||||
|
<list>
|
||||||
|
<ref bean="patch.updateGuestPermission" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
<bean id="patch.categoryRootPermission" class="org.alfresco.repo.admin.patch.impl.CategoryRootPermissionPatch" parent="basePatch" >
|
||||||
|
<property name="id"><value>patch.categoryRootPermission</value></property>
|
||||||
|
<property name="description"><value>patch.categoryRootPermission.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>5</value></property>
|
||||||
|
<property name="targetSchema"><value>6</value></property>
|
||||||
|
<!-- helper beans for execution -->
|
||||||
|
<property name="permissionService">
|
||||||
|
<ref bean="permissionService"/>
|
||||||
|
</property>
|
||||||
|
<property name="searchService">
|
||||||
|
<ref bean="searchService"/>
|
||||||
|
</property>
|
||||||
|
<property name="nodeService">
|
||||||
|
<ref bean="nodeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="namespaceService">
|
||||||
|
<ref bean="namespaceService"/>
|
||||||
|
</property>
|
||||||
|
<property name="spacesBootstrap">
|
||||||
|
<ref bean="spacesBootstrap" />
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -378,8 +378,8 @@
|
|||||||
<property name="afterInvocationManager"><ref local="afterInvocationManager"/></property>
|
<property name="afterInvocationManager"><ref local="afterInvocationManager"/></property>
|
||||||
<property name="objectDefinitionSource">
|
<property name="objectDefinitionSource">
|
||||||
<value>
|
<value>
|
||||||
org.alfresco.service.cmr.repository.ContentService.getReader=ACL_NODE.0.cm:content.ReadContent
|
org.alfresco.service.cmr.repository.ContentService.getReader=ACL_NODE.0.sys:base.ReadContent
|
||||||
org.alfresco.service.cmr.repository.ContentService.getWriter=ACL_NODE.0.cm:content.WriteContent
|
org.alfresco.service.cmr.repository.ContentService.getWriter=ACL_NODE.0.sys:base.WriteContent
|
||||||
org.alfresco.service.cmr.repository.ContentService.isTransformable=ACL_ALLOW
|
org.alfresco.service.cmr.repository.ContentService.isTransformable=ACL_ALLOW
|
||||||
org.alfresco.service.cmr.repository.ContentService.transform=ACL_ALLOW
|
org.alfresco.service.cmr.repository.ContentService.transform=ACL_ALLOW
|
||||||
org.alfresco.service.cmr.repository.ContentService.getTempWriter=ACL_ALLOW
|
org.alfresco.service.cmr.repository.ContentService.getTempWriter=ACL_ALLOW
|
||||||
|
@@ -11,8 +11,8 @@ version.label=
|
|||||||
|
|
||||||
# Edition label
|
# Edition label
|
||||||
|
|
||||||
version.edition=Open Source
|
version.edition=Community Network
|
||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
|
|
||||||
version.schema=5
|
version.schema=6
|
||||||
|
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.i18n.I18NUtil;
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||||
|
import org.alfresco.service.cmr.admin.PatchException;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grant <b>Consumer</b> role to <b>Guest</b> in <b>Category Root</b> folder.
|
||||||
|
* <p>
|
||||||
|
* This patch expects the folder to be present.
|
||||||
|
*/
|
||||||
|
public class CategoryRootPermissionPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private static final String MSG_RESULT = "patch.categoryRootPermission.result";
|
||||||
|
private static final String ERR_NOT_FOUND = "patch.categoryRootPermission.err.not_found";
|
||||||
|
|
||||||
|
private PermissionService permissionService;
|
||||||
|
private ImporterBootstrap spacesBootstrap;
|
||||||
|
private SearchService searchService;
|
||||||
|
private NamespaceService namespaceService;
|
||||||
|
private NodeService nodeService;
|
||||||
|
|
||||||
|
|
||||||
|
public void setPermissionService(PermissionService permissionService)
|
||||||
|
{
|
||||||
|
this.permissionService = permissionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpacesBootstrap(ImporterBootstrap spacesBootstrap)
|
||||||
|
{
|
||||||
|
this.spacesBootstrap = spacesBootstrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearchService(SearchService searchService)
|
||||||
|
{
|
||||||
|
this.searchService = searchService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNamespaceService(NamespaceService namespaceService)
|
||||||
|
{
|
||||||
|
this.namespaceService = namespaceService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
String categoryRootPath = "/cm:categoryRoot";
|
||||||
|
|
||||||
|
// find category root
|
||||||
|
NodeRef rootNodeRef = nodeService.getRootNode(spacesBootstrap.getStoreRef());
|
||||||
|
List<NodeRef> nodeRefs = searchService.selectNodes(rootNodeRef, categoryRootPath, null, namespaceService, false);
|
||||||
|
if (nodeRefs.size() == 0)
|
||||||
|
{
|
||||||
|
String msg = I18NUtil.getMessage(ERR_NOT_FOUND, categoryRootPath);
|
||||||
|
throw new PatchException(msg);
|
||||||
|
}
|
||||||
|
NodeRef categoryRootRef = nodeRefs.get(0);
|
||||||
|
|
||||||
|
// apply permission
|
||||||
|
permissionService.setPermission(categoryRootRef, PermissionService.GUEST_AUTHORITY, PermissionService.READ, true);
|
||||||
|
|
||||||
|
// done
|
||||||
|
String msg = I18NUtil.getMessage(MSG_RESULT, categoryRootPath);
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import org.alfresco.i18n.I18NUtil;
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change Guest Person permission from Guest to Read
|
||||||
|
*
|
||||||
|
* Guest (now Consumer) permission is not valid for cm:person type.
|
||||||
|
*/
|
||||||
|
public class GuestPersonPermissionPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private static final String MSG_SUCCESS = "patch.guestPersonPermission.result";
|
||||||
|
|
||||||
|
private PersonService personService;
|
||||||
|
|
||||||
|
private PermissionService permissionService;
|
||||||
|
|
||||||
|
private String guestId = "guest";
|
||||||
|
|
||||||
|
public GuestPersonPermissionPatch()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGuestId(String guestId)
|
||||||
|
{
|
||||||
|
this.guestId = guestId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissionService(PermissionService permissionService)
|
||||||
|
{
|
||||||
|
this.permissionService = permissionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPersonService(PersonService personService)
|
||||||
|
{
|
||||||
|
this.personService = personService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
if (personService.personExists(guestId))
|
||||||
|
{
|
||||||
|
NodeRef personRef = personService.getPerson(guestId);
|
||||||
|
permissionService.setInheritParentPermissions(personRef, false);
|
||||||
|
permissionService.deletePermission(personRef, guestId, PermissionService.CONSUMER, true);
|
||||||
|
permissionService.setPermission(personRef, guestId, PermissionService.READ, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return I18NUtil.getMessage(MSG_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -177,7 +177,7 @@ public class GuestUserPatch extends AbstractPatch
|
|||||||
NodeRef personRef = personService.getPerson(guestId);
|
NodeRef personRef = personService.getPerson(guestId);
|
||||||
|
|
||||||
permissionService.setInheritParentPermissions(personRef, false);
|
permissionService.setInheritParentPermissions(personRef, false);
|
||||||
permissionService.setPermission(personRef, guestId, PermissionService.READ, true);
|
permissionService.setPermission(personRef, guestId, PermissionService.CONSUMER, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,8 +237,8 @@ public class GuestUserPatch extends AbstractPatch
|
|||||||
private void setGuestHomePermissions(NodeRef nodeRef)
|
private void setGuestHomePermissions(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
permissionService.setInheritParentPermissions(nodeRef, false);
|
permissionService.setInheritParentPermissions(nodeRef, false);
|
||||||
permissionService.setPermission(nodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.GUEST, true);
|
permissionService.setPermission(nodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER, true);
|
||||||
permissionService.setPermission(nodeRef, guestId, PermissionService.GUEST, true);
|
permissionService.setPermission(nodeRef, guestId, PermissionService.CONSUMER, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeRef setCompanyHomeSpacePermissions(NodeRef storeRootNodeRef, String companyHomeChildName)
|
private NodeRef setCompanyHomeSpacePermissions(NodeRef storeRootNodeRef, String companyHomeChildName)
|
||||||
@@ -259,7 +259,7 @@ public class GuestUserPatch extends AbstractPatch
|
|||||||
NodeRef companyHomeRef = nodeRefs.get(0);
|
NodeRef companyHomeRef = nodeRefs.get(0);
|
||||||
|
|
||||||
permissionService.setInheritParentPermissions(companyHomeRef, false);
|
permissionService.setInheritParentPermissions(companyHomeRef, false);
|
||||||
permissionService.setPermission(companyHomeRef, PermissionService.ALL_AUTHORITIES, PermissionService.GUEST,
|
permissionService.setPermission(companyHomeRef, PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER,
|
||||||
true);
|
true);
|
||||||
return companyHomeRef;
|
return companyHomeRef;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import org.alfresco.i18n.I18NUtil;
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change Spaces Root Node permission from Guest to Read
|
||||||
|
*
|
||||||
|
* Guest (now Consumer) permission is not valid for sys:store_root type.
|
||||||
|
*/
|
||||||
|
public class SpacesRootPermissionPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private static final String MSG_SUCCESS = "patch.spacesRootPermission.result";
|
||||||
|
|
||||||
|
private ImporterBootstrap spacesBootstrap;
|
||||||
|
private NodeService nodeService;
|
||||||
|
private PermissionService permissionService;
|
||||||
|
|
||||||
|
|
||||||
|
public SpacesRootPermissionPatch()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpacesBootstrap(ImporterBootstrap spacesBootstrap)
|
||||||
|
{
|
||||||
|
this.spacesBootstrap = spacesBootstrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissionService(PermissionService permissionService)
|
||||||
|
{
|
||||||
|
this.permissionService = permissionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
NodeRef rootNodeRef = nodeService.getRootNode(spacesBootstrap.getStoreRef());
|
||||||
|
permissionService.deletePermission(rootNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.CONSUMER, true);
|
||||||
|
permissionService.setPermission(rootNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||||
|
|
||||||
|
return I18NUtil.getMessage(MSG_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.i18n.I18NUtil;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.repo.security.permissions.impl.hibernate.PermissionReference;
|
||||||
|
import org.alfresco.repo.security.permissions.impl.hibernate.PermissionReferenceImpl;
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.springframework.orm.hibernate3.HibernateCallback;
|
||||||
|
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The permission 'Guest' has been renamed to 'Consumer'.
|
||||||
|
*
|
||||||
|
* @author David Caruana
|
||||||
|
*/
|
||||||
|
public class UpdateGuestPermissionPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private static final String MSG_SUCCESS = "patch.updateGuestPermission.result";
|
||||||
|
|
||||||
|
private HibernateHelper helper;
|
||||||
|
|
||||||
|
public UpdateGuestPermissionPatch()
|
||||||
|
{
|
||||||
|
helper = new HibernateHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSessionFactory(SessionFactory sessionFactory)
|
||||||
|
{
|
||||||
|
this.helper.setSessionFactory(sessionFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
List<String> createdNames = helper.createPermissionReferences();
|
||||||
|
int updatedPermEntries = helper.updatePermissionEntries();
|
||||||
|
|
||||||
|
// build the result message
|
||||||
|
String msg = I18NUtil.getMessage(MSG_SUCCESS, createdNames, updatedPermEntries);
|
||||||
|
// done
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class HibernateHelper extends HibernateDaoSupport
|
||||||
|
{
|
||||||
|
private static final String NAME_OLD = "Guest";
|
||||||
|
private static final String NAME_NEW = "Consumer";
|
||||||
|
private static final String[] NAMES = new String[] {"Consumer"};
|
||||||
|
|
||||||
|
private static final String QUERY_UPDATE_PERM_ENTRY_NAME = "permission.patch.UpdatePermissionName";
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> createPermissionReferences()
|
||||||
|
{
|
||||||
|
List<String> createdNames = new ArrayList<String>(4);
|
||||||
|
for (String name : NAMES)
|
||||||
|
{
|
||||||
|
// create permission references as required, double checking for their existence first
|
||||||
|
PermissionReference ref = new PermissionReferenceImpl();
|
||||||
|
ref.setTypeUri(ContentModel.TYPE_CMOBJECT.getNamespaceURI());
|
||||||
|
ref.setTypeName(ContentModel.TYPE_CMOBJECT.getLocalName());
|
||||||
|
ref.setName(name);
|
||||||
|
|
||||||
|
// it acts as its own key
|
||||||
|
PermissionReference found = (PermissionReference) getHibernateTemplate().get(
|
||||||
|
PermissionReferenceImpl.class,
|
||||||
|
ref);
|
||||||
|
|
||||||
|
if (found == null)
|
||||||
|
{
|
||||||
|
// it was not found, so create it
|
||||||
|
getHibernateTemplate().save(ref);
|
||||||
|
createdNames.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return createdNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updatePermissionEntries()
|
||||||
|
{
|
||||||
|
HibernateCallback callback = new HibernateCallback()
|
||||||
|
{
|
||||||
|
public Object doInHibernate(Session session)
|
||||||
|
{
|
||||||
|
// flush any outstanding entities
|
||||||
|
session.flush();
|
||||||
|
|
||||||
|
Query query = session.getNamedQuery(HibernateHelper.QUERY_UPDATE_PERM_ENTRY_NAME);
|
||||||
|
query.setString("nameNew", NAME_NEW)
|
||||||
|
.setString("nameOld", NAME_OLD);
|
||||||
|
int updateCount = query.executeUpdate();
|
||||||
|
return new Integer(updateCount);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Integer updateCount = (Integer) getHibernateTemplate().execute(callback);
|
||||||
|
// done
|
||||||
|
return updateCount.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -43,6 +43,7 @@
|
|||||||
where
|
where
|
||||||
appliedPatch.appliedOnDate >= :fromDate and
|
appliedPatch.appliedOnDate >= :fromDate and
|
||||||
appliedPatch.appliedOnDate <= :toDate
|
appliedPatch.appliedOnDate <= :toDate
|
||||||
|
order by appliedPatch.appliedOnDate
|
||||||
]]>
|
]]>
|
||||||
</query>
|
</query>
|
||||||
|
|
||||||
|
@@ -23,7 +23,6 @@ import java.io.Reader;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
@@ -353,6 +352,7 @@ public class ImporterBootstrap implements ApplicationListener
|
|||||||
// Create import binding
|
// Create import binding
|
||||||
BootstrapBinding binding = new BootstrapBinding();
|
BootstrapBinding binding = new BootstrapBinding();
|
||||||
binding.setConfiguration(configuration);
|
binding.setConfiguration(configuration);
|
||||||
|
binding.setLocation(importLocation);
|
||||||
String messages = bootstrapView.getProperty(VIEW_MESSAGES_PROPERTY);
|
String messages = bootstrapView.getProperty(VIEW_MESSAGES_PROPERTY);
|
||||||
if (messages != null && messages.length() > 0)
|
if (messages != null && messages.length() > 0)
|
||||||
{
|
{
|
||||||
@@ -431,6 +431,12 @@ public class ImporterBootstrap implements ApplicationListener
|
|||||||
{
|
{
|
||||||
private Properties configuration = null;
|
private Properties configuration = null;
|
||||||
private ResourceBundle resourceBundle = null;
|
private ResourceBundle resourceBundle = null;
|
||||||
|
private Location bootstrapLocation = null;
|
||||||
|
|
||||||
|
private static final String IMPORT_LOCATION_UUID = "bootstrap.location.uuid";
|
||||||
|
private static final String IMPORT_LOCATION_NODEREF = "bootstrap.location.noderef";
|
||||||
|
private static final String IMPORT_LOCATION_PATH = "bootstrap.location.path";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Import Configuration
|
* Set Import Configuration
|
||||||
@@ -462,6 +468,16 @@ public class ImporterBootstrap implements ApplicationListener
|
|||||||
this.resourceBundle = resourceBundle;
|
this.resourceBundle = resourceBundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Location
|
||||||
|
*
|
||||||
|
* @param location
|
||||||
|
*/
|
||||||
|
public void setLocation(Location location)
|
||||||
|
{
|
||||||
|
this.bootstrapLocation = location;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.cmr.view.ImporterBinding#getValue(java.lang.String)
|
* @see org.alfresco.service.cmr.view.ImporterBinding#getValue(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -476,6 +492,22 @@ public class ImporterBootstrap implements ApplicationListener
|
|||||||
{
|
{
|
||||||
value = resourceBundle.getString(key);
|
value = resourceBundle.getString(key);
|
||||||
}
|
}
|
||||||
|
if (value == null && bootstrapLocation != null)
|
||||||
|
{
|
||||||
|
if (key.equals(IMPORT_LOCATION_UUID))
|
||||||
|
{
|
||||||
|
value = bootstrapLocation.getNodeRef().getId();
|
||||||
|
}
|
||||||
|
else if (key.equals(IMPORT_LOCATION_NODEREF))
|
||||||
|
{
|
||||||
|
value = bootstrapLocation.getNodeRef().toString();
|
||||||
|
}
|
||||||
|
else if (key.equals(IMPORT_LOCATION_PATH))
|
||||||
|
{
|
||||||
|
value = bootstrapLocation.getPath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,6 +53,7 @@ import org.alfresco.service.cmr.search.SearchParameters;
|
|||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
import org.alfresco.service.cmr.security.AccessPermission;
|
import org.alfresco.service.cmr.security.AccessPermission;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
import org.alfresco.service.cmr.security.OwnableService;
|
import org.alfresco.service.cmr.security.OwnableService;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
@@ -95,6 +96,7 @@ public class ImporterComponent
|
|||||||
private RuleService ruleService;
|
private RuleService ruleService;
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
private AuthorityService authorityService;
|
private AuthorityService authorityService;
|
||||||
|
private AuthenticationService authenticationService;
|
||||||
private OwnableService ownableService;
|
private OwnableService ownableService;
|
||||||
|
|
||||||
// binding markers
|
// binding markers
|
||||||
@@ -184,6 +186,14 @@ public class ImporterComponent
|
|||||||
this.authorityService = authorityService;
|
this.authorityService = authorityService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param authenticationService authenticationService
|
||||||
|
*/
|
||||||
|
public void setAuthenticationService(AuthenticationService authenticationService)
|
||||||
|
{
|
||||||
|
this.authenticationService = authenticationService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ownableService ownableService
|
* @param ownableService ownableService
|
||||||
*/
|
*/
|
||||||
@@ -948,8 +958,13 @@ public class ImporterComponent
|
|||||||
{
|
{
|
||||||
// Resolve path to node reference
|
// Resolve path to node reference
|
||||||
NodeRef nodeRef = null;
|
NodeRef nodeRef = null;
|
||||||
|
importedRef = bindPlaceHolder(importedRef, binding);
|
||||||
|
|
||||||
if (importedRef.startsWith("/"))
|
if (importedRef.equals("/"))
|
||||||
|
{
|
||||||
|
nodeRef = sourceNodeRef;
|
||||||
|
}
|
||||||
|
else if (importedRef.startsWith("/"))
|
||||||
{
|
{
|
||||||
// resolve absolute path
|
// resolve absolute path
|
||||||
SearchParameters searchParameters = new SearchParameters();
|
SearchParameters searchParameters = new SearchParameters();
|
||||||
@@ -1197,7 +1212,7 @@ public class ImporterComponent
|
|||||||
// apply permissions
|
// apply permissions
|
||||||
List<AccessPermission> permissions = null;
|
List<AccessPermission> permissions = null;
|
||||||
AccessStatus writePermission = permissionService.hasPermission(nodeRef, PermissionService.CHANGE_PERMISSIONS);
|
AccessStatus writePermission = permissionService.hasPermission(nodeRef, PermissionService.CHANGE_PERMISSIONS);
|
||||||
if (writePermission.equals(AccessStatus.ALLOWED))
|
if (authenticationService.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
||||||
{
|
{
|
||||||
permissions = node.getAccessControlEntries();
|
permissions = node.getAccessControlEntries();
|
||||||
for (AccessPermission permission : permissions)
|
for (AccessPermission permission : permissions)
|
||||||
@@ -1377,7 +1392,7 @@ public class ImporterComponent
|
|||||||
// Apply permissions
|
// Apply permissions
|
||||||
List<AccessPermission> permissions = null;
|
List<AccessPermission> permissions = null;
|
||||||
AccessStatus writePermission = permissionService.hasPermission(existingNodeRef, PermissionService.CHANGE_PERMISSIONS);
|
AccessStatus writePermission = permissionService.hasPermission(existingNodeRef, PermissionService.CHANGE_PERMISSIONS);
|
||||||
if (writePermission.equals(AccessStatus.ALLOWED))
|
if (authenticationService.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
||||||
{
|
{
|
||||||
boolean inheritPermissions = node.getInheritPermissions();
|
boolean inheritPermissions = node.getInheritPermissions();
|
||||||
if (!inheritPermissions)
|
if (!inheritPermissions)
|
||||||
|
@@ -60,6 +60,7 @@ public class ViewParser implements Parser
|
|||||||
private static final String VIEW_ID_ATTR = "id";
|
private static final String VIEW_ID_ATTR = "id";
|
||||||
private static final String VIEW_IDREF_ATTR = "idref";
|
private static final String VIEW_IDREF_ATTR = "idref";
|
||||||
private static final String VIEW_PATHREF_ATTR = "pathref";
|
private static final String VIEW_PATHREF_ATTR = "pathref";
|
||||||
|
private static final String VIEW_NODEREF_ATTR = "noderef";
|
||||||
private static final QName VIEW_METADATA = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "metadata");
|
private static final QName VIEW_METADATA = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "metadata");
|
||||||
private static final QName VIEW_VALUE_QNAME = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "value");
|
private static final QName VIEW_VALUE_QNAME = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "value");
|
||||||
private static final QName VIEW_VALUES_QNAME = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "values");
|
private static final QName VIEW_VALUES_QNAME = QName.createQName(NamespaceService.REPOSITORY_VIEW_1_0_URI, "values");
|
||||||
@@ -409,30 +410,36 @@ public class ViewParser implements Parser
|
|||||||
node.setReference(true);
|
node.setReference(true);
|
||||||
|
|
||||||
// Extract Import scoped reference Id if explicitly defined
|
// Extract Import scoped reference Id if explicitly defined
|
||||||
String idRef = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_IDREF_ATTR);
|
String idRefAttr = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_IDREF_ATTR);
|
||||||
String pathRef = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_PATHREF_ATTR);
|
String pathRefAttr = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_PATHREF_ATTR);
|
||||||
|
String nodeRefAttr = xpp.getAttributeValue(NamespaceService.REPOSITORY_VIEW_1_0_URI, VIEW_NODEREF_ATTR);
|
||||||
|
|
||||||
if ((idRef != null && idRef.length() > 0) && (pathRef != null && pathRef.length() > 0))
|
if ((idRefAttr != null && idRefAttr.length() > 0) && (pathRefAttr != null && pathRefAttr.length() > 0) && (nodeRefAttr != null && nodeRefAttr.length() > 0))
|
||||||
{
|
{
|
||||||
// Do not support both IDREF and PATHREF
|
// Do not support both IDREF and PATHREF
|
||||||
throw new ImporterException("Only one of " + VIEW_IDREF_ATTR + " or " + VIEW_PATHREF_ATTR + " can be specified.");
|
throw new ImporterException("Only one of " + VIEW_IDREF_ATTR + " or " + VIEW_PATHREF_ATTR + " or " + VIEW_NODEREF_ATTR + " can be specified.");
|
||||||
}
|
}
|
||||||
if (idRef != null && idRef.length() > 0)
|
if (nodeRefAttr != null)
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = new NodeRef(nodeRefAttr);
|
||||||
|
node.setUUID(nodeRef.getId());
|
||||||
|
}
|
||||||
|
else if (idRefAttr != null && idRefAttr.length() > 0)
|
||||||
{
|
{
|
||||||
// retrieve uuid from previously imported node
|
// retrieve uuid from previously imported node
|
||||||
NodeRef nodeRef = getImportReference(parserContext, idRef);
|
NodeRef nodeRef = getImportReference(parserContext, idRefAttr);
|
||||||
if (nodeRef == null)
|
if (nodeRef == null)
|
||||||
{
|
{
|
||||||
throw new ImporterException("Cannot find node referenced by id " + idRef);
|
throw new ImporterException("Cannot find node referenced by id " + idRefAttr);
|
||||||
}
|
}
|
||||||
node.setUUID(nodeRef.getId());
|
node.setUUID(nodeRef.getId());
|
||||||
}
|
}
|
||||||
else if (pathRef != null && pathRef.length() > 0)
|
else if (pathRefAttr != null && pathRefAttr.length() > 0)
|
||||||
{
|
{
|
||||||
NodeRef referencedRef = parserContext.importer.resolvePath(pathRef);
|
NodeRef referencedRef = parserContext.importer.resolvePath(pathRefAttr);
|
||||||
if (referencedRef == null)
|
if (referencedRef == null)
|
||||||
{
|
{
|
||||||
throw new ImporterException("Cannot find node referenced by path " + pathRef);
|
throw new ImporterException("Cannot find node referenced by path " + pathRefAttr);
|
||||||
}
|
}
|
||||||
node.setUUID(referencedRef.getId());
|
node.setUUID(referencedRef.getId());
|
||||||
}
|
}
|
||||||
@@ -766,8 +773,8 @@ public class ViewParser implements Parser
|
|||||||
*/
|
*/
|
||||||
private void processEndType(ParserContext parserContext, NodeContext node)
|
private void processEndType(ParserContext parserContext, NodeContext node)
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = node.getNodeRef();
|
|
||||||
importNode(parserContext, node);
|
importNode(parserContext, node);
|
||||||
|
NodeRef nodeRef = node.getNodeRef();
|
||||||
node.getImporter().childrenImported(nodeRef);
|
node.getImporter().childrenImported(nodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -79,10 +79,10 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
gas[0] = new GrantedAuthorityImpl("ROLE_SYSTEM");
|
gas[0] = new GrantedAuthorityImpl("ROLE_SYSTEM");
|
||||||
ud = new User(SYSTEM_USER_NAME, "", true, true, true, true, gas);
|
ud = new User(SYSTEM_USER_NAME, "", true, true, true, true, gas);
|
||||||
}
|
}
|
||||||
else if (userName.equalsIgnoreCase(PermissionService.GUEST))
|
else if (userName.equalsIgnoreCase(PermissionService.GUEST_AUTHORITY))
|
||||||
{
|
{
|
||||||
GrantedAuthority[] gas = new GrantedAuthority[0];
|
GrantedAuthority[] gas = new GrantedAuthority[0];
|
||||||
ud = new User(PermissionService.GUEST.toLowerCase(), "", true, true, true, true, gas);
|
ud = new User(PermissionService.GUEST_AUTHORITY.toLowerCase(), "", true, true, true, true, gas);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
*/
|
*/
|
||||||
public String getGuestUserName()
|
public String getGuestUserName()
|
||||||
{
|
{
|
||||||
return PermissionService.GUEST.toLowerCase();
|
return PermissionService.GUEST_AUTHORITY.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -227,7 +227,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
{
|
{
|
||||||
if(implementationAllowsGuestLogin())
|
if(implementationAllowsGuestLogin())
|
||||||
{
|
{
|
||||||
return setCurrentUser(PermissionService.GUEST);
|
return setCurrentUser(PermissionService.GUEST_AUTHORITY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -238,7 +238,7 @@ public abstract class AbstractAuthenticationComponent implements AuthenticationC
|
|||||||
{
|
{
|
||||||
if(allowGuestLogin.booleanValue())
|
if(allowGuestLogin.booleanValue())
|
||||||
{
|
{
|
||||||
return setCurrentUser(PermissionService.GUEST);
|
return setCurrentUser(PermissionService.GUEST_AUTHORITY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -43,7 +43,7 @@ public class SimpleAuthorityServiceImpl implements AuthorityService
|
|||||||
|
|
||||||
private Set<String> adminSet = Collections.singleton(PermissionService.ADMINISTRATOR_AUTHORITY);
|
private Set<String> adminSet = Collections.singleton(PermissionService.ADMINISTRATOR_AUTHORITY);
|
||||||
|
|
||||||
private Set<String> guestSet = Collections.singleton(PermissionService.GUEST);
|
private Set<String> guestSet = Collections.singleton(PermissionService.GUEST_AUTHORITY);
|
||||||
|
|
||||||
private Set<String> allSet = Collections.singleton(PermissionService.ALL_AUTHORITIES);
|
private Set<String> allSet = Collections.singleton(PermissionService.ALL_AUTHORITIES);
|
||||||
|
|
||||||
|
@@ -129,7 +129,7 @@ public class SimpleAuthorityServiceTest extends TestCase
|
|||||||
assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).contains(
|
assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.GROUP).contains(
|
||||||
PermissionService.ALL_AUTHORITIES));
|
PermissionService.ALL_AUTHORITIES));
|
||||||
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).size());
|
assertEquals(1, pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).size());
|
||||||
assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).contains(PermissionService.GUEST));
|
assertTrue(pubAuthorityService.getAllAuthorities(AuthorityType.GUEST).contains(PermissionService.GUEST_AUTHORITY));
|
||||||
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.OWNER).size());
|
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.OWNER).size());
|
||||||
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.ROLE).size());
|
assertEquals(0, pubAuthorityService.getAllAuthorities(AuthorityType.ROLE).size());
|
||||||
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
assertEquals(2, pubAuthorityService.getAllAuthorities(AuthorityType.USER).size());
|
||||||
|
@@ -41,7 +41,6 @@ import org.alfresco.service.cmr.security.AccessStatus;
|
|||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityType;
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.EqualsHelper;
|
import org.alfresco.util.EqualsHelper;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@@ -149,5 +149,14 @@
|
|||||||
typeName = :typeNameOld and
|
typeName = :typeNameOld and
|
||||||
name in ('Coordinator', 'Contributor', 'Editor', 'Guest')
|
name in ('Coordinator', 'Contributor', 'Editor', 'Guest')
|
||||||
</query>
|
</query>
|
||||||
|
|
||||||
|
<query name="permission.patch.UpdatePermissionName" >
|
||||||
|
update
|
||||||
|
org.alfresco.repo.security.permissions.impl.hibernate.PermissionEntryImpl as entry
|
||||||
|
set
|
||||||
|
name = :nameNew
|
||||||
|
where
|
||||||
|
name = :nameOld
|
||||||
|
</query>
|
||||||
|
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
@@ -110,7 +110,7 @@ public enum AuthorityType
|
|||||||
|
|
||||||
public String getFixedString()
|
public String getFixedString()
|
||||||
{
|
{
|
||||||
return PermissionService.GUEST;
|
return PermissionService.GUEST_AUTHORITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPrefixed()
|
public boolean isPrefixed()
|
||||||
@@ -219,7 +219,7 @@ public enum AuthorityType
|
|||||||
{
|
{
|
||||||
authorityType = AuthorityType.OWNER;
|
authorityType = AuthorityType.OWNER;
|
||||||
}
|
}
|
||||||
else if (authority.equalsIgnoreCase(PermissionService.GUEST))
|
else if (authority.equalsIgnoreCase(PermissionService.GUEST_AUTHORITY))
|
||||||
{
|
{
|
||||||
authorityType = AuthorityType.GUEST;
|
authorityType = AuthorityType.GUEST;
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,7 @@ public interface PermissionService
|
|||||||
|
|
||||||
public static final String ADMINISTRATOR_AUTHORITY = "ROLE_ADMINISTRATOR";
|
public static final String ADMINISTRATOR_AUTHORITY = "ROLE_ADMINISTRATOR";
|
||||||
|
|
||||||
|
public static final String GUEST_AUTHORITY = "guest";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ public interface PermissionService
|
|||||||
|
|
||||||
public static final String EDITOR = "Editor";
|
public static final String EDITOR = "Editor";
|
||||||
|
|
||||||
public static final String GUEST = "Guest";
|
public static final String CONSUMER = "Consumer";
|
||||||
|
|
||||||
public static final String LOCK = "Lock";
|
public static final String LOCK = "Lock";
|
||||||
|
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
package org.alfresco.service.cmr.view;
|
package org.alfresco.service.cmr.view;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -163,6 +162,14 @@ public interface Exporter
|
|||||||
*/
|
*/
|
||||||
public void endProperties(NodeRef nodeRef);
|
public void endProperties(NodeRef nodeRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export start of value collection
|
||||||
|
*
|
||||||
|
* @param nodeRef the node reference
|
||||||
|
* @param property the property name
|
||||||
|
*/
|
||||||
|
public void startValueCollection(NodeRef nodeRef, QName property);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export single valued property
|
* Export single valued property
|
||||||
*
|
*
|
||||||
@@ -173,16 +180,15 @@ public interface Exporter
|
|||||||
public void value(NodeRef nodeRef, QName property, Object value);
|
public void value(NodeRef nodeRef, QName property, Object value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export multi valued property
|
* Export end of value collection
|
||||||
*
|
*
|
||||||
* @param nodeRef the node reference
|
* @param nodeRef the node reference
|
||||||
* @param property the property name
|
* @param property the property name
|
||||||
* @param value the value
|
|
||||||
*/
|
*/
|
||||||
public void value(NodeRef nodeRef, QName property, Collection values);
|
public void endValueCollection(NodeRef nodeRef, QName property);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export content stream
|
* Export content stream property
|
||||||
*
|
*
|
||||||
* @param nodeRef the node reference
|
* @param nodeRef the node reference
|
||||||
* @param property the property name
|
* @param property the property name
|
||||||
|
@@ -18,10 +18,9 @@ package org.alfresco.tools;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.alfresco.repo.exporter.FileExportPackageHandler;
|
|
||||||
import org.alfresco.repo.exporter.ACPExportPackageHandler;
|
import org.alfresco.repo.exporter.ACPExportPackageHandler;
|
||||||
|
import org.alfresco.repo.exporter.FileExportPackageHandler;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -239,6 +238,7 @@ public final class Export extends Tool
|
|||||||
}
|
}
|
||||||
catch(ExporterException e)
|
catch(ExporterException e)
|
||||||
{
|
{
|
||||||
|
e.printStackTrace();
|
||||||
throw new ToolException("Failed to export", e);
|
throw new ToolException("Failed to export", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -552,16 +552,23 @@ public final class Export extends Tool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable)
|
* @see org.alfresco.service.cmr.view.Exporter#startValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
||||||
*/
|
*/
|
||||||
public void value(NodeRef nodeRef, QName property, Object value)
|
public void startValueCollection(NodeRef nodeRef, QName property)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Collection)
|
* @see org.alfresco.service.cmr.view.Exporter#endValueCollection(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
||||||
*/
|
*/
|
||||||
public void value(NodeRef nodeRef, QName property, Collection values)
|
public void endValueCollection(NodeRef nodeRef, QName property)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.alfresco.service.cmr.view.Exporter#value(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.io.Serializable)
|
||||||
|
*/
|
||||||
|
public void value(NodeRef nodeRef, QName property, Object value)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,10 +634,7 @@ public final class Export extends Tool
|
|||||||
*/
|
*/
|
||||||
public void endReference(NodeRef nodeRef)
|
public void endReference(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user