<permissionGroup name="Write" expose="true" allowFullControl="false">
<includePermissionGroup type="sys:base" permissionGroup="WriteProperties"/>
<!–
<includePermissionGroup type="sys:base" permissionGroup="WriteContent"/>
–>
</permissionGroup>
- J'ai créé une dynamicAuthority qui donne l'authority ROLE_WRITER_ACCORDING_STATUS en fonction du statut du document. Cette authority dispose du permissionGroup WriteContent<globalPermission permission="WriteContent" authority="ROLE_WRITER_ACCORDING_STATUS" />
public boolean hasAuthority(final NodeRef nodeRef, String userName) {
System.out.println("WriterAccordingStatusDynamicAuthority#hasAuthority("+nodeRef+", "+userName+")");
return AuthenticationUtil.runAs(new RunAsWork<Boolean>(){
public Boolean doWork() throws Exception
{
boolean hasAuthority = true;
// find its type so we can see if it's a node we are interested in
QName type = nodeService.getType(nodeRef);
// make sure the type is defined in the data dictionary
TypeDefinition typeDef = dictionaryService.getType(type);
if (typeDef != null)
{
// Look for Content node
if (dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)){
String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
System.out.println("WriterAccordingStatusDynamicAuthority#hasAuthority => Type CONTENT : "+name);
// Get the status of the node
String status = (String)nodeService.getProperty(nodeRef, CeaModel.PROP_STATUS);
// If the status is different from draft or approval in progress, the authority is denied
if(!CeaModel.STATUS_DRAFT.equals(status) && !CeaModel.STATUS_APPROVAL_IN_PROGRESS.equals(status)){
hasAuthority = false;
}
}
}
System.out.println("WriterAccordingStatusDynamicAuthority#hasAuthority => "+hasAuthority);
return hasAuthority;
}}, AuthenticationUtil.getSystemUserName());
}
<permissionGroup name="WriteAccordingStatus" expose="false" allowFullControl="false" />
<permission name="_WriteAccordingStatus" expose="false">
<grantedToGroup permissionGroup="WriteAccordingStatus" />
</permission>
- J'ai modifié la permission _WriteContent. J'ai ajouté un tag requiredPermission :
<permission name="_WriteContent" expose="false">
<grantedToGroup permissionGroup="WriteContent" />
<!– Commented out parent permission check …
<requiredPermission on="parent" name="_ReadChildren" implies="false"/>
–>
<requiredPermission on="node" name="_WriteAccordingStatus" implies="false"/>
</permission>
- J'ai mis en commentaires ma globalPermission sur l'authority ROLE_WRITER_ACCORDING_STATUS.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.