cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow reporting solo para Administradores

maria_p
Champ in-the-making
Champ in-the-making

Buenas, por favor me podrían decir si se puede bloquear un dashlet para los usuarios no Administradores. Tengo el addon de workflow reporting y solo quiero que los administradores accedan a el. Gracias. Feliz Semana

3 REPLIES 3

douglascrp
World-Class Innovator
World-Class Innovator

Puedes decir cuál es el addon?

maria_p
Champ in-the-making
Champ in-the-making

Hola Douglas, el addon es workflow reporting Workflow Reporting | Alfresco Add-ons - Alfresco Customizations 

Gracias

douglascrp
World-Class Innovator
World-Class Innovator

This is an interesting addon that I did not know about. Thank you for sharing it.

Back to your question on how to hide it from non admin users, it seems the addon itself does not offer that option.

In that case, I think the only way you can change that will be by customizing the customise-dashlets webscript's controller (the customise-dashlets.get.js file).

I have done exactly that, and all I can do now in order to try to help you is to share the code I created at the time. It has some comments (in Portuguese though), so I hope you can adapt the idea to your use case.

/* **
    DGCloud custom start
    A priori serão disponibilizadas as seguintes dashlets:

    Painel Inicial
    1-Meu Calendário
    2-Minhas Atividades
    3-Feeds RSS
    4-Pesquisa Salva

    Meu Escritório
    1-Calendário do Site
    2-Atividades do Site
    3-Conteúdo do Site
    4-Links do Site
*/

var dashletsPainelUsuario = ["user-calendar", "my-activities", "rssfeed", "saved-search"];

var dashletsPainelSite = ["calendar", "site-activities", "docsummary", "site-links"];

function searchInArray(value, array) {
    var i;
    for (i = 0; i < array.length; i++) {
        if (array[i] == value) {
            return true
        }
    }

    return false;
}

/* **
    Copia do original, com as alteracoes destacadas nos comentarios
*/

function customDashletsFilter()
{
   // Get available components of family/type dashlet
   var webscripts;
   if (args.dashboardType == "user")
   {
      webscripts = sitedata.findWebScripts("user-dashlet");
   }
   else if (args.dashboardType == "site")
   {
      webscripts = sitedata.findWebScripts("site-dashlet");
   }
   if (!webscripts)
   {
      webscripts = [];
   }
   var tmp = sitedata.findWebScripts("dashlet");
   if (tmp || tmp.length != 0)
   {
      webscripts = webscripts.concat(tmp);
   }

   // Transform the webscripts to easy-to-access dashlet items for the template
   var availableDashlets = [];
   var usergroups;
   for (var i = 0; i < webscripts.length; i++)
   {
      var webscript = webscripts[i];
      var uris = webscript.getURIs();
      var scriptId, scriptName, shortNameId, descriptionId;
      if (uris !== null && uris.length > 0 && webscript.shortName !== null)
      {
         // Check if the webscript is limited to certain groups
         var allowed = true;
         for (var fi = 0; fi < webscript.familys.length; fi++)
         {
            if (webscript.familys[fi].indexOf("group:") == 0)
            {
               allowed = false;
               var group = webscript.familys[fi].substring("group:".length).trim();
               group += ""; // make it of type "string" rather than "object" so that indexOf works
               if (!usergroups)
               {
                  usergroups = getUserGroups();
               }
               if (usergroups.indexOf(group) != -1)
               {
                  allowed = true;
                  break;
               }
            }
         }

         if (allowed)
         {
            // Use the webscript ID to generate a message bundle ID
            //
            // This should really be retrieved from an explicit value but the web scripts framework does not provide
            // a means for storing message bundle IDs, and the web framework is not being used here.
            scriptId = webscript.id;
            scriptName = scriptId.substring(scriptId.lastIndexOf("/") + 1, scriptId.lastIndexOf("."));
            shortNameId = "dashlet." + scriptName + ".shortName";
            descriptionId = "dashlet." + scriptName + ".description";

            /* **
                DGCloud: so adiciona o dashlet na lista se fizer parte das listas de dashlets permitidos
            */

            if ((args.dashboardType == "user" && searchInArray(scriptName, dashletsPainelUsuario)) ||
                (args.dashboardType == "site" && searchInArray(scriptName, dashletsPainelSite))) {

                availableDashlets.push(
                   {
                      url: uris[0],
                      // msg.get(key) returns key if no matching value
                      shortName: (msg.get(shortNameId) != shortNameId ? msg.get(shortNameId) : webscript.shortName),
                      description: (msg.get(descriptionId) != descriptionId ? msg.get(descriptionId) : webscript.description)
                   });
            }
         }
      }
      // else skip this webscript since it lacks uri or shortName
   }

   model.availableDashlets = availableDashlets;
}

customDashletsFilter();‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
Getting started

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.