FA

Hi all ,

please help me , i want to show report contain all user for all databases .

i do it manualy using  ArisData.openDatabase(nameofDataBase) , but i want all database

 

Best Regards ,  

by Tricarico Romain
Posted on Thu, 06/22/2017 - 13:54

Hi Ahmad,

I suggest to use the UMC component :

var umc = Context.getComponent("UMC");

var umcUsers = umc.getAllUsers();

 

Best Regards.

0
by Faris adel Author
Posted on Thu, 06/22/2017 - 14:15

hi Tricarico Romain ,

when excute code give me an error on getAllUsers()  and saied it is not exist

Best Regards ,

0
by Florian Rese
Posted on Fri, 06/23/2017 - 08:05

Hi Ahmad,

below are a few options, which all work for me, when trying to retrieve the list of all users (including the one from Tricarico, which is working for me). There are probably better/ more convenient ways to achieve, what you are looking for, but all 4 of these options work for me:

var database_list = ArisData.getSelectedDatabases(); //database(s) selected for the report

function main(){

    if (database_list.length > 0) {

        for (var i = 0 ; i < database_list.length; i++ ){

            var current_database = database_list[i];

            var user_list = current_database.AssignedUsers();

            user_list = __sort(user_list, Constants.SORT_TYPE, Constants.AT_NAME, Constants.SORT_NONE, g_nloc);

            

            var user_list_2 = current_database.UserList();

            user_list_2 = __sort(user_list, Constants.SORT_TYPE, Constants.AT_NAME, Constants.SORT_NONE, g_nloc);

            

            var UMC         = Context.getComponent("UMC");

            var user_list_3 = UMC.getAllUsers().toArray();

            user_list_3 = __sort(user_list, Constants.SORT_TYPE, Constants.AT_NAME, Constants.SORT_NONE, g_nloc);

            

            var UserGroupsList = current_database.UserGroupList();

            var user_list_4 = [];

            var counter = 0;

            var users_per_group =[];

            var max_users = 0;

            for (var j = 0; j < UserGroupsList.length; j++){

                var current_user_group = UserGroupsList[j];

                users_per_group[j] = [current_user_group];

                var current_user_group_users = current_user_group.UserList();

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

                    user_list_4[k+counter] = current_user_group_users[k];

                    users_per_group[j][k] = current_user_group_users[k];

                    if (current_user_group_users.length > max_users){

                        max_users = current_user_group_users.length;

                    }

                }

                counter = counter + current_user_group_users.length;

            }

0
by Faris adel Author
Posted on Mon, 06/26/2017 - 09:42

In reply to by FlorianRese

Hi Florian Rese ,

thanks alot for trying to help me , but i faced problem that when the dialog is shown to select database(s) , if i select one of database then the array have 1 element but i select more then one of databases the array have no element , i no have idea about this problem

Best Regards ,

0
by Sumeet Satwani
Posted on Mon, 06/26/2017 - 10:53

HI

 

You can try the below code, its gives the user names along with their groups:

 

var g_Output    = Context.createOutputObject();

var g_Locale    = 1033;

var UMC         = Context.getComponent("UMC");

main();

function main() {

    initializeOutput();

    g_Output.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT,  Constants.FMT_LEFT | Constants.FMT_REPEAT_HEADER, 0)

   

    /*g_Output.TableRow();

    writeHeader(getString("REPORT_TITLE"), 7);

    g_Output.TableRow();

    writeDescription(getString("REPORT_DESCRIPTION"), 7);

    g_Output.TableRow(); */

    writeTableCell("");

    g_Output.TableRow();

   

    writeTableHeaderCell(getString("COLUMN_USERGROUP_NAME"), 40);

    //writeTableHeaderCell(getString("COLUMN_LICENSE_PRIVILEGES"), 40);

    //writeTableHeaderCell(getString("COLUMN_FUNCTION_PRIVILEGES"), 40);

    writeTableHeaderCell(getString("COLUMN_LAST_NAME"), 30);

    writeTableHeaderCell(getString("COLUMN_FIRST_NAME"), 30);

    //writeTableHeaderCell(getString("COLUMN_EMAIL_ADDRESS"), 50);

    writeTableHeaderCell(getString("COLUMN_USER_NAME"), 30);

   

    var selectedUsergroupNames = getSelectionList();

   

    var usergroups = UMC.getAllUsergroups();

   

    var isEvenCell = true;

   

    for(var i = 0 ; i < usergroups.size() ; i++) {

        isEvenCell = !isEvenCell;

        var usergroup = usergroups.get(i);

        var name = usergroup.getName();

       

        if(!selectedUsergroupNames.isEmpty() && !selectedUsergroupNames.contains(name)) {

            continue;

        }

       

        g_Output.TableRow();

       

        var licensePrivileges = UMC.getPrivilegesForUsergroup(usergroup, false, true);

        var functionPrivileges = UMC.getPrivilegesForUsergroup(usergroup, true, false);

        var assignedUsers = UMC.getAssignedUsersForUsergroup(usergroup);

       

        writeTableCell(name, 40, isEvenCell);

        var rows = assignedUsers.size();

        for(var j = 0 ; j < rows ; j++) {

            if(j != 0) {

                g_Output.TableRow();

                writeTableCell("", 40, isEvenCell);

            }

            if(assignedUsers.size() > j) {

                var user = assignedUsers.get(j);

                writeTableCell(user.getLastName(), 30, isEvenCell);

                writeTableCell(user.getFirstName(), 30, isEvenCell); 

              

                writeTableCell(user.getName(), 30, isEvenCell); 

            } else {

                writeTableCell("", 30, isEvenCell);  

                writeTableCell("", 30, isEvenCell);

              

                writeTableCell("", 30, isEvenCell);

            }

        }  

    }

    g_Output.WriteReport();

}

0

Featured achievement

Genius
You like to help others solve their problems by answering questions.
Recent Unlocks
  • KF
  • KH
  • RG
  • Profile picture for user Vee_ARIS
  • Profile picture for user smarty
  • PacMan

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