0
votes

My requirement is i don't want to allow any user to create or upload any folder or document inside all sub folders of document library. for this i need to make create children permission false. So please tell me How to make create Children permission false for all sub folders inside alfresco document library for all users.

Please provide sample code snippet and steps to do this.

Thanks in advance

1
Why are you asking for a code snippet, why is simply defining appropriate permissions (then inheriting it down the document library) not an option? - Lista
Change the role of site for usergroup for which you don't want to allow create children permission. - Krutik Jayswal
Hi Krutik, Can you explain that how can i change the role of site for user group. I am quite new in alfresco, so not getting how to do this. i write some code in changePermission.js but i am getting errors. So please provide steps and if possible, provide sample code snipet. Thanks in advance. - Deepak Talape
Hi Lista, Actually i read some posts on forum, so i conclude that to hide create and upload option for non document library folder, i need ti make create permission false. But i am not getting what exactly should i do or where to do. Thats why asking for help. Thanks. - Deepak Talape

1 Answers

2
votes

I think you can create your own PermisionGroup.

Add in your projet your xml file definition :

main\amp\config\alfresco\module\mymodule\bootstrap\custom-sitePermissionDefinitions.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE permissions >
<!-- Custom permissions-->
<permissions>
    <!-- Namespaces used in type references -->
   <namespaces>
      <namespace uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
      <namespace uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
      <namespace uri="http://www.alfresco.org/model/site/1.0" prefix="st"/>
  </namespaces>

   <permissionSet type="st:site" expose="selected">
    <!-- Keep the existing -->
   <permissionGroup name="SiteManager" allowFullControl="true" expose="true" />

   <permissionGroup name="SiteCollaborator" allowFullControl="false" expose="true">
      <includePermissionGroup permissionGroup="Collaborator" type="cm:cmobject" />
   </permissionGroup>

   <permissionGroup name="SiteContributor" allowFullControl="false" expose="true">
      <includePermissionGroup permissionGroup="Contributor" type="cm:cmobject" />
   </permissionGroup>

    <permissionGroup name="SiteConsumer" allowFullControl="false" expose="true">
         <includePermissionGroup permissionGroup="Consumer" type="cm:cmobject" />
         <includePermissionGroup permissionGroup="ReadPermissions" type="sys:base" />
    </permissionGroup>

  <!-- Custom role based on the contributor one            -->
  <permissionGroup name="MyCustomRole" allowFullControl="false" expose="true" >
      <includePermissionGroup permissionGroup="Consumer" type="cm:cmobject"/>
       <!-- remove the permission to add a children
      <includePermissionGroup permissionGroup="AddChildren" type="sys:base"/>
      -->
      <includePermissionGroup permissionGroup="ReadPermissions" type="sys:base" />
  </permissionGroup>

Don't forget to declare it in your context file (module-context.xml) :

<!-- Registration of myproject ROLES -->
<bean id="myproject_permissionBootstrapSite" parent="permissionModelBootstrap">
  <property name="model" value="alfresco/module/${project.artifactId}/bootstrap/custom-sitePermissionDefinitions.xml"/>
</bean>