 
					
				
		
04-24-2013 09:21 AM
 
					
				
		
04-30-2013 07:21 AM
IN share-config-custom.xml
<config evaluator="string-compare" condition="DataLists">
      <!–
           A list of workflow definitions that are displayed in Share start-workflow page based on grant options
           - grant-type: "user" or "group"
           - grant-name: group name or user name (based on grant-type) allowed
         –>
      <grant-datalists>
         <datalist name="ruc:RegistruUnicCorespondenta" grant-type="user" grant-name="ureg" />
         <datalist name="dl:RegistruUnicCorespondenta" grant-type="user" grant-name="ureg" />
      </grant-datalists>
   </config>
**** and in ** datalists.get.js
function oc(a) 
{
   var o = {};
   for(var i=0;i<a.length;i++) 
   {
      o[a.itemName]='';
   }
   return o;
}
 
function getVisibleDataListsNames() 
{
   var visibleDLNames = [],
       myconn = remote.connect("alfresco"),
      myres = myconn.get("/api/people/"+ user.name +"?groups=true");
   
   if (myres.status == 200) 
   {
      var groups = eval('(' + myres + ')').groups,
            grantDL = config.scoped["DataLists"]["grant-datalists"].childrenMap["datalist"];
      if (grantDL) 
      {
         for (var i = 0, il = grantDL.size(); i < il; i++) 
         {
            if (grantDL.get(i).attributes["grant-type"] == "group") 
            {
               if (grantDL.get(i).attributes["grant-name"] in oc(groups)) 
               {
                  // The user can start the workflow because he belongs to the group allowed
                  continue;
               }
            } else if (grantDL.get(i).attributes["grant-type"] == "user") 
            {
               if (grantDL.get(i).attributes["grant-name"] == user.name) 
               {
                  // The user can start the workflow because he is the allowed
                  continue;
               }
            }
            visibleDLNames.push(grantDL.get(i).attributes["name"]);
         }
      }
      return visibleDLNames;
   }
   return [];
}
function getListTypes()
{
   var types = [],
      result = remote.call("/api/classes/dl_dataListItem/subclasses");
   
   if (result.status == 200)
   {
      var classes = eval('(' + result + ')'),
         subclass,
         visibleDL = getVisibleDataListsNames();
         
         logger.log("*** datalists.get.js: visible" + visibleDL + ";user:" + user.name);
      
      for (var i = 0, ii = classes.length; i < ii; i++)
      {
         subclass = classes;
         if (subclass.name == "dl:dataListItem")
         {
            // Ignore abstract parent type
            continue;
         }
       
         if (visibleDL){
            logger.log("*** datalists.get.js 111 in if visibleDL:" + subclass.name + ";" + subclass.title);
            for each (el in visibleDL) {
               if (subclass.name == el) 
               {
                  logger.log("*** datalists.get.js 111 in for + if. el:" + el);
                  types.push(
                  {
                     name: subclass.name,
                     title: subclass.title,
                     description: subclass.description
                  });
               }
            }
         }
         else {
            logger.log("*** datalists.get.js in else:" + subclass.name + ";" + subclass.title);
             types.push(
             {
                  name: subclass.name,
                  title: subclass.title,
                  description: subclass.description
             });
         }
      } //for i
   } //if
   
   logger.log("*** datalists.get.js types:" + types);
   return types;
}//function
model.listTypes = getListTypes();
function main()
{
   // Widget instantiation metadata…
   var dataLists = {
      id : "DataLists", 
      name : "Alfresco.component.DataLists",
      options : {
         siteId : (page.url.templateArgs.site != null) ? page.url.templateArgs.site : "",
         containerId : template.properties.container != null ? template.properties.container : "dataLists",
         listId : (page.url.args.list != null) ? page.url.args.list : "",
         listTypes : model.listTypes
      }
   };
   
   model.widgets = [dataLists];
}
main();
 
					
				
				
			
		
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.