permissionService.setInheritParentPermissions(fichier,false);
permissionService.deletePermission(fichier, "GROUP_VALIDATEUR", PermissionService.COORDINATOR);
permissionService.getPermissions(fichierTrouve);
rien ne change!!!
permissionService.setInheritParentPermissions(destinationParent, false);
permissionService.setPermission(destinationParent, "GROUP_VALIDATEUR", PermissionService.COORDINATOR,true);
*
*
*
permissionService.deletePermission(destinationParent, "GROUP_VALIDATEUR", PermissionService.COORDINATOR);
permissionService.setInheritParentPermissions(fichier,false);
permissionService.setPermission(fichier, "GROUP_VALIDATEUR", PermissionService.COORDINATOR,true);
*
*
*
permissionService.deletePermission(fichier, "GROUP_VALIDATEUR", PermissionService.COORDINATOR);
permissionService.setInheritParentPermissions(fichierTrouve,true);
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
{
public Void doWork() throws Exception
{
// code java
return null;
}
}, "admin");
List<FileInfo> listFichierEtDossier = fileFolderService.list(destinationParent);
for( FileInfo fichierOuDossier : listFichierEtDossier)
{
if(!(fichierOuDossier.isFolder())&&!(fichierOuDossier.isLink()))
{
String NomDuFichierCourant=(String) nodeService.getProperty(fichierOuDossier.getNodeRef(),ContentModel.PROP_NAME);
if(NomDuFichierCourant.equals(NomDuFichier))
{
fichierTrouve2 = fichierOuDossier.getNodeRef();
}
}
}
nodeService.setProperty(fichierTrouve2, ContentModel.PROP_OWNER, "admin");
}
}
public class CopyAndVersioningActionExecuter extends ActionExecuterAbstractBase
{
public static final String NAME = "copyAndVersioning";
public static final String PARAM_DESTINATION_FOLDER = "destination-folder";
private Logger logger = Logger.getLogger(CopyAndVersioningActionExecuter.class);
private NodeRef destinationParent;
private NodeRef fichierTrouve;
private NodeService nodeService;
private FileFolderService fileFolderService;
private CheckOutCheckInService checkOutCheckInService;
NodeRef fichierTrouve2=null;
/**
* Node service
**/
public void setNodeService(NodeService nodeService)
{
this.nodeService=nodeService;
}
/**
* FileFolder service
**/
public void setFileFolderService(FileFolderService fileFolderService)
{
this.fileFolderService = fileFolderService;
}
/**
* CheckOutCheckIn service
**/
public void setCheckOutCheckInService(CheckOutCheckInService checkOutCheckInService)
{
this.checkOutCheckInService = checkOutCheckInService;
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
{
paramList.add(new ParameterDefinitionImpl(PARAM_DESTINATION_FOLDER,
DataTypeDefinition.NODE_REF,
true,
getParamDisplayLabel(PARAM_DESTINATION_FOLDER)));
}
@Override
protected void executeImpl(Action MonAction, final NodeRef actionedUponNodeRef)
{
destinationParent = (NodeRef)MonAction.getParameterValue(PARAM_DESTINATION_FOLDER);
final String NomDuFichier = (String) nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME);
fichierTrouve = null;
logger.info("lancement du traitement Test pour le fichier: " + NomDuFichier );
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
{
public Void doWork() throws Exception
{
try
{
logger.info("Traitement en tant qu administrateur");
List<FileInfo> listFichierEtDossier = fileFolderService.list(destinationParent);
if(listFichierEtDossier.isEmpty())
{
logger.info("le dossier de destination ne contient aucun element");
if(nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE)==false)
{
nodeService.addAspect(actionedUponNodeRef,ContentModel.ASPECT_VERSIONABLE,null);
}
fileFolderService.copy(actionedUponNodeRef, destinationParent, null);
Map<String,Serializable> versionProperties = new HashMap<String,Serializable>(1);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
logger.info("le fichier est deplace dans le dossier vide");
return null;
}
else{
logger.info("le dossier contient des elements");
for( FileInfo fichierOuDossier : listFichierEtDossier)
{
if(!(fichierOuDossier.isFolder())&&!(fichierOuDossier.isLink()))
{
// fichierOuDossier est un fichier
String NomDuFichierCourant=(String) nodeService.getProperty(fichierOuDossier.getNodeRef(),ContentModel.PROP_NAME);
if(NomDuFichierCourant.equals(NomDuFichier))
{
fichierTrouve = fichierOuDossier.getNodeRef();
if(nodeService.hasAspect(fichierTrouve, ContentModel.ASPECT_VERSIONABLE)==false)
{
nodeService.addAspect(fichierTrouve,ContentModel.ASPECT_VERSIONABLE,null);
}
logger.info(" le fichier existe dans le repertoire de destination et changement d'aspect ");
}
}
}
}
if(fichierTrouve != null)
{
checkOutCheckInService.checkout(fichierTrouve);
logger.info("checkout du fichier");
NodeRef copieDeTravail=checkOutCheckInService.getWorkingCopy(fichierTrouve);
ContentData Contenu = (ContentData) nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_CONTENT);
nodeService.setProperty(copieDeTravail, ContentModel.PROP_CONTENT, Contenu);
logger.info("modification du contenu du fichier trouve");
Map<String,Serializable> versionProperties = new HashMap<String,Serializable>(1);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
logger.info("attribution d'une version majeur");
checkOutCheckInService.checkin(copieDeTravail, versionProperties);
logger.info("checkin du fichier et fichier source efface");
}else{
logger.info("il n existe pas de versions anterieures");
if(nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE)==false)
{
nodeService.addAspect(actionedUponNodeRef,ContentModel.ASPECT_VERSIONABLE,null);
}
fileFolderService.copy(actionedUponNodeRef, destinationParent, null);
Map<String,Serializable> versionProperties = new HashMap<String,Serializable>(1);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
logger.info("nouveau fichier deplace");
}
}
catch (FileNotFoundException e)
{
// ne rien faire
}
List<FileInfo> listFichierEtDossier = fileFolderService.list(destinationParent);
for( FileInfo fichierOuDossier : listFichierEtDossier)
{
if(!(fichierOuDossier.isFolder())&&!(fichierOuDossier.isLink()))
{
String NomDuFichierCourant=(String) nodeService.getProperty(fichierOuDossier.getNodeRef(),ContentModel.PROP_NAME);
if(NomDuFichierCourant.equals(NomDuFichier))
{
fichierTrouve2 = fichierOuDossier.getNodeRef();
}
}
}
nodeService.setProperty(fichierTrouve2, ContentModel.PROP_OWNER, "admin");
return null;
}
}, "admin");
}
}
Veuillez corriger les erreurs ci-dessous puis cliquez sur OK.
Échec de la création de contenu en raison d'une erreur : 01270005 Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnAddAspectPolicy.onAddAspect(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName) in transaction 80a5f0c0-bb6e-4bbb-9f34-b6e162464df4
11:07:48,114 User:xxx ERROR [ui.common.Utils] Échec de la création de contenu en raison d'une erreur : 01270005 Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnAddAspectPolicy.onAddAspect(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName) in transaction 80a5f0c0-bb6e-4bbb-9f34-b6e162464df4
org.alfresco.error.AlfrescoRuntimeException: 01270005 Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnAddAspectPolicy.onAddAspect(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName) in transaction 80a5f0c0-bb6e-4bbb-9f34-b6e162464df4
at org.alfresco.repo.policy.TransactionBehaviourQueue.execute(TransactionBehaviourQueue.java:195)
at org.alfresco.repo.policy.TransactionBehaviourQueue.beforeCommit(TransactionBehaviourQueue.java:127)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:732)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:736)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:712)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:672)
at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:394)
at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:403)
at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:124)
at org.alfresco.web.bean.dialog.DialogManager.finish(DialogManager.java:528)
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)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:104)
at sun.reflect.GeneratedMethodAccessor495.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy213.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:68)
at sun.reflect.GeneratedMethodAccessor495.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy213.doFilter(Unknown Source)
at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.repo.security.permissions.AccessDeniedException: 01270004 Access refusé. Vous n'avez pas la permission de réaliser cette opération.
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:48)
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 $Proxy7.setProperty(Unknown Source)
at org.alfresco.repo.version.Version2ServiceImpl.createVersion(Version2ServiceImpl.java:350)
at org.alfresco.repo.version.Version2ServiceImpl.createVersion(Version2ServiceImpl.java:139)
at org.alfresco.repo.version.VersionableAspect.createVersionImpl(VersionableAspect.java:426)
at org.alfresco.repo.version.VersionableAspect.onAddAspect(VersionableAspect.java:270)
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)
at org.alfresco.repo.policy.JavaBehaviour$JavaMethodInvocationHandler.invoke(JavaBehaviour.java:173)
at $Proxy10.onAddAspect(Unknown Source)
at sun.reflect.GeneratedMethodAccessor515.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.policy.TransactionBehaviourQueue.execute(TransactionBehaviourQueue.java:183)
… 64 more
Caused by: net.sf.acegisecurity.AccessDeniedException: Access is denied.
at net.sf.acegisecurity.vote.AffirmativeBased.decide(AffirmativeBased.java:86)
at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:394)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
… 87 more
Caused by: org.alfresco.repo.security.permissions.AccessDeniedException: 01270004 Access refusé. Vous n'avez pas la permission de réaliser cette opération.
else
{
logger.info("utilisateur : "+ AuthenticationUtil.getRunAsUser());
if(nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE)==false)
{
nodeService.addAspect(actionedUponNodeRef,ContentModel.ASPECT_VERSIONABLE,null);
}
fileFolderService.copy(actionedUponNodeRef, destinationParent, null);
Map<String,Serializable> versionProperties = new HashMap<String,Serializable>(1);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
}
logger.info("utilisateur : "+ AuthenticationUtil.getRunAsUser());revoie : admin :mrgreen:
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{
public Object doWork() throws Exception
{
UserTransaction Trans = serviceRegistry.getTransactionService().getUserTransaction();
try {
Trans.begin();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
/// code java
Trans.commit();
}
catch (Throwable e) {
try {
if (Trans.getStatus() == Status.STATUS_ACTIVE)
{
Trans.rollback();
}
} catch (Throwable ee) {
logger.error("", e);
}
logger.error("", e);
}
return null;
}
},AuthenticationUtil.getSystemUserName());
}
}
Échec de la création de contenu en raison d'une erreur : 01280005 Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnAddAspectPolicy.onAddAspect(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName) in transaction 9d1a186d-f962-4f64-bb96-46364ce8e170
org.alfresco.error.AlfrescoRuntimeException: 01280005 Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnAddAspectPolicy.onAddAspect(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName)
org.alfresco.repo.security.permissions.AccessDeniedException: 01280004 Access refusé. Vous n'avez pas la permission de réaliser cette opération.
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.