为什么这个错误找不到{http://www.alfresco.org/model/system/1.0}base.Read &是什么意思
我需要创建一个新类以将其用作引导程序来创建文件夹和节点,
<bean id="com.ds.module.extensions.Core.securityRequirementBootstrap" class="com.ds.ui.bean.dialog.module.SecurityRequirementBootstrap" init-method="init">
<property name="searchService">
<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;
}
但此代码将引发异常
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)
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">
<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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
异常表示存储库找不到 sys:base 类型的读取权限。
您是否更改或覆盖了
露天/模型/permissionDefinitions.xml?如果是,您很可能在那里遇到错误。
我注意到的另一件事是,您应该始终使用 关闭 lucene 结果集尝试finally模式。
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.