07-15-2010 12:06 PM
07-20-2010 04:41 AM
07-23-2010 05:57 AM
<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.07-29-2010 10:48 AM
07-29-2010 11:02 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.