PG

Hello everyone 

I'm definitely not a Javascript guy so I think that what I'm going to ask is a piece of cake for those who have the skills.

The thing is, I was asked to modify the Output Group Information report so the users won't appear in the report. At that time what I did was simply to comment those lines involving users such as:

 

// ---------------------------------

// Output of users.

// ---------------------------------

/* function userout(ousers, ocurrentgroup, bUserColored_holder) {

    // Output of users.

    for (var k = 0 ; k < ousers.length ; k++ ){

        var ocurrentuser = ousers[k];

        var ocurrentattribute = ocurrentuser.Attribute(1000, g_nloc);

        

        var currentAccessRights = ocurrentuser.AccessRights(ocurrentgroup);

        var bread = (currentAccessRights & Constants.AR_READ) == Constants.AR_READ;

        var bwrite = (currentAccessRights & Constants.AR_WRITE) == Constants.AR_WRITE;

        var bdelete = (currentAccessRights & Constants.AR_DELETE) == Constants.AR_DELETE;    

        var bsubmit = g_bIsDbVersionable && ((currentAccessRights & Constants.AR_SUBMIT) == Constants.AR_SUBMIT);

        

        g_ooutfile.TableRow();

        g_nRowCount++;

        g_ooutfile.TableCell("", 24, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);

        g_ooutfile.TableCell("", 20, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);

        g_ooutfile.TableCell(ocurrentattribute.GetValue(true), 20, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);
        g_ooutfile.TableCell((bread ? "X" : ""), g_nWidthAR, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_CENTER | Constants.FMT_VTOP, 0);

        g_ooutfile.TableCell((bwrite ? "X" : ""), g_nWidthAR, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_CENTER | Constants.FMT_VTOP, 0);

        g_ooutfile.TableCell((bdelete ? "X" : ""), g_nWidthAR, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_CENTER | Constants.FMT_VTOP, 0);

        if (g_bIsDbVersionable) {

            g_ooutfile.TableCell((bsubmit ? "X" : ""), g_nWidthAR, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_CENTER | Constants.FMT_VTOP, 0);

        }

        bUserColored_holder.value = !bUserColored_holder.value; // Change background color

    }

} */

Now I'm asked to remove all user groups without any type of access and here's where I'm stuck at right now.

To explain it better, the current outcome is the first image whereas the desired outcome is the second image

In other words, those user groups without access rights should not appear in the report when a particular process is being displayed.

 

The code of this report is attached to this thread in case you want to take a look on it.

As usual, thank you so much for your assistance

Kind regards

Pedro.

 

File attachments
by Kay Fischbach
Posted on Thu, 07/12/2018 - 10:54

Ok, your Report has a section called "Output of user groups."

This section contains a function called "usergroupout". Basically what this does is it evaluates whether or not a usergroup has rights for a particular group, and then writes a tableRow for the particular usergroup.

What you want to do is let it do the evaluation so you can find out if you want to write a line for this group, and then simply surround the output part with an if-block (you can read about if-blocks here https://www.w3schools.com/js/js_if_else.asp , really simple stuff). An if-block basically asks for a condition, if the condition is met when the program reaches the block, the code inside the block is executed, otherwise the code inside the block is skipped.

For the condition that the if block asks for you have two options that immediately come to my mind (there might be more, idk):

  • either you chain your booleans for the access rights together with logical-OR operators ( || in the code), so if the report finds out the usergroup has one or more rights it will execute the code inside the block and write a row. The if statement for that would be if(bread || bwrite || bdelete || bsubmit){
  • or you take advantage of the fact that Constants.AR_NORIGHTS corresponds to the int value 0. So if your "currentAccessRights" variable says 0 at the time where the if condition is checked, you don't want to write a row. The if statement for that would be if(currentAccessRights != Constants.AR_NORIGHTS){

Example for how your complete usergroupout method could look like after you modified it:

function usergroupout(ocurrentgroup, bUserColored_holder) {

    for (var k = 0 ; k < g_ousergroups.length ; k++ ){

        var ocurrentusergroup = g_ousergroups[k];

        var ocurrentattribute = ocurrentusergroup.Attribute(1000, g_nloc);

        var currentAccessRights = ocurrentusergroup.AccessRights(ocurrentgroup);

        var bread = (currentAccessRights & Constants.AR_READ) == Constants.AR_READ;

        var bwrite = (currentAccessRights & Constants.AR_WRITE) == Constants.AR_WRITE;

        var bdelete = (currentAccessRights & Constants.AR_DELETE) == Constants.AR_DELETE;  

        var bsubmit = g_bIsDbVersionable && ((currentAccessRights & Constants.AR_SUBMIT) == Constants.AR_SUBMIT);

        if(bread || bwrite || bdelete || bsubmit){

            g_ooutfile.TableRow();

            g_nRowCount++;

            g_ooutfile.TableCell("", 24, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);

            g_ooutfile.TableCell(ocurrentattribute.GetValue(true), 20, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 0);

            g_ooutfile.TableCell("", 20, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, 136, 0);

            g_ooutfile.TableCell((bread ? "X" : ""), g_nWidthAR, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_CENTER | Constants.FMT_VTOP, 0);

            g_ooutfile.TableCell((bwrite ? "X" : ""), g_nWidthAR, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_CENTER | Constants.FMT_VTOP, 0);

            g_ooutfile.TableCell((bdelete ? "X" : ""), g_nWidthAR, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_CENTER | Constants.FMT_VTOP, 0);

            if (g_bIsDbVersionable) {

                g_ooutfile.TableCell((bsubmit ? "X" : ""), g_nWidthAR, getString("TEXT1"), 10, Constants.C_BLACK, getTableCellColor_AttrBk(bUserColored_holder.value), 0, Constants.FMT_CENTER | Constants.FMT_VTOP, 0);

            }

            bUserColored_holder.value = !bUserColored_holder.value; // Change background color

        }

/*        if (g_mUserGroupUsers.containsKey(ocurrentusergroup.GUID())) {

            userout(g_mUserGroupUsers.get(ocurrentusergroup.GUID()), ocurrentgroup, bUserColored_holder);

        }*/

    }

}

 

Sidenote: Please also provide the content of the String table the next time you provide a report script. Unloading strings into the string table, and then ripping them apart simply causes an unpleasant user experience for anyone who has just the report script without the string table.

 

Edit: Just noticed my code was one closing bracket short. Added it.

0
by Pedro Guerrero Author
Posted on Wed, 07/18/2018 - 20:53

It actually worked!

Thank you for your help

Regards

Pedro.

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock