Alfresco在bootstrap中为节点设置权限

时间:2012-05-02 15:59:09

标签: permissions alfresco bootstrapping

我在为现有节点(“Sites”文件夹)设置权限时遇到问题。我有一个小组,我需要给她“站点”文件夹的完全控制权限。我为这个

使用了下一个xml
<cm:folder view:childName="cm:Sites">
    <view:acl>
        <view:ace view:access="ALLOWED">
            <view:authority>GROUP_NOTEBOOK_PROJECT_CREATOR_GROUP</view:authority>
            <view:permission>FullControl</view:permission>
        </view:ace>
    </view:acl>
    <view:properties>
        <cm:name>Sites</cm:name>
        <sys:node-uuid>1e6f0610-a018-4966-ab37-c71e809dc6ed</sys:node-uuid>
    </view:properties>
</cm:folder>

和下一个配置上下文

<bean id="com.agilent.datastore.notebook.server.systemBootstrap" class="org.alfresco.repo.module.ImporterModuleComponent"
parent="module.baseComponent">
<property name="moduleId" value="${artifactId}" />
<property name="name" value="${name}" />
<property name="description" value="${description}" />
<property name="sinceVersion" value="${noSnapshotVersion}.${buildNumber}" />
<property name="appliesFromVersion" value="${noSnapshotVersion}.${buildNumber}" />
<!-- Uncomment next line if you want to execute bootstrap again -->
<!-- property name="executeOnceOnly" value="false" / -->
<property name="importer" ref="spacesBootstrap" />
<property name="bootstrapViews">
  <list>
    <props>
      <prop key="uuidBinding">UPDATE_EXISTING</prop>
      <prop key="path">/${spaces.company_home.childname}</prop>
      <prop key="location">alfresco/extension/agilent/sites.acp</prop>

但是当我启动这个文件夹时,我得到了异常Cannot insert duplicate key row in object 'dbo.alf_child_assoc' with unique index 'parent_node_id'.; nested exception is java.sql.SQLException: Cannot insert duplicate key row in object 'dbo.alf_child_assoc' with unique index 'parent_node_id'.

1 个答案:

答案 0 :(得分:0)

实现你想要的最好方法是编写一个补丁,这是一个扩展了露天AbstractPatch.java类的java类。

在applyInternal方法中,首先使用xpath-search获取sites-folder,因为它在后台使用nodeService。 Solr在执行此代码期间无法使用,因为补丁是在bootstrap期间运行的。

在弹出上下文文件中声明修补程序,如下所示:

<bean id="patch.setPermissionsOnSitesFolderPatch"     class="org.yourdomain.alfresco.patch.SetPermissionOnSitesFolderPatch" parent="basePatch">
<property name="id">
  <value>patch.patch.setPermissionsOnSitesFolderPatch</value>
</property>
<property name="description">
  <value>patch.setPermissionsOnSitesFolderPatch.description</value>
</property>
<property name="fixesFromSchema">
  <value>0</value>
</property>
<property name="fixesToSchema">
  <value>${version.schema}</value>
</property>
 <property name="targetSchema">
   <value>10000</value>
  </property>
  <property name="force" value="true" />

  <property name="repository" ref="repositoryHelper"/>
</bean>