开发者

Why This Error Can not find {http://www.alfresco.org/model/system/1.0}base.Read & What's mean

开发者 https://www.devze.com 2023-03-28 19:16 出处:网络
I need to create a new class to use it as bootstrap to create folders and nodes <bean id=\"com.ds.module.extensions.Core.securityRequirementBootstrap\" class=\"com.ds.ui.bean.dialog.module.Securit

I need to create a new class to use it as bootstrap to create folders and nodes

<bean id="com.ds.module.extensions.Core.securityRequirementBootstrap" class="com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap" init-method="init">
  <property name="searchService"&g开发者_开发问答t;
     <ref bean="SearchService"/>
  </property>
  <property name="nodeService">
     <ref bean="NodeService"/>
  </property>      
    <property name="transactionService">
        <ref bean="transactionService" />
    </property>
</bean> 

public class SecurityRequirementBootstrap {
public void init() throws Exception{
    AuthenticationUtil.runAs(new RunAsWork<String>() {
        public String doWork() throws Exception {
            transaction = transactionService.getUserTransaction();
            transaction.begin();
            NodeUtil.checkSecurityPreRequesite(searchService,nodeService);
            transaction.commit();
            return "";
        }
    }, "admin");
}

public synchronized static final Node acquireSequencesFolder(SearchService searchService){
    NodeRef nodeRef = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
            SearchService.LANGUAGE_LUCENE,"@"+NamespaceService.CONTENT_MODEL_PREFIX+"\\:"+ContentModel.PROP_NAME.getLocalName()+":\""+Constants.SEQUENCES_FOLDER_NODE_NAME_STRING+"\"").getNodeRef(0);
    if(nodeRef != null)
        return new Node(nodeRef);
    return null;
}

but this code will throws an exception

aused by: java.lang.UnsupportedOperationException: Can not find {http://www.alfresco.org/model/system/1.0}base.Read
at org.alfresco.repo.security.permissions.impl.model.PermissionModel.getPermissionReference(PermissionModel.java:1321)
at org.alfresco.repo.security.permissions.impl.PermissionServiceImpl.getPermissionReference(PermissionServiceImpl.java:956)
at org.alfresco.repo.security.permissions.impl.PermissionServiceImpl.hasPermission(PermissionServiceImpl.java:976)
at org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationProvider.decideOld(ACLEntryAfterInvocationProvider.java:756)
at org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationProvider.decide(ACLEntryAfterInvocationProvider.java:528)
at org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationProvider.decide(ACLEntryAfterInvocationProvider.java:511)
at org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvocationProvider.decide(ACLEntryAfterInvocationProvider.java:298)
at net.sf.acegisecurity.afterinvocation.AfterInvocationProviderManager.decide(AfterInvocationProviderManager.java:107)
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.afterInvocation(AbstractSecurityInterceptor.java:329)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:82)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:217)
at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:184)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:137)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy36.query(Unknown Source)
at com.ds.ui.bean.dialog.util.NodeUtil.acquireSequencesFolder(NodeUtil.java:68)
at com.ds.ui.bean.dialog.util.NodeUtil.checkSequencesExistance(NodeUtil.java:327)
at com.ds.ui.bean.dialog.util.NodeUtil.checkSecurityPreRequesite(NodeUtil.java:455)
at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap$1.doWork(SecurityRequirementBootstrap.java:21)
at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap$1.doWork(SecurityRequirementBootstrap.java:1)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:508)
at com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap.init(SecurityRequirementBootstrap.java:17)
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)


The exception says that the repository can not find the Read permission for the sys:base type.

  • Have you changed or overwritten the alfresco/model/permissionDefinitions.xml? If yes, you most likely have an error there.

  • Another thing I noticed is, that you should always close your lucene resultsets using a try finally pattern.

0

精彩评论

暂无评论...
验证码 换一张
取 消