Getting the usernames or users list

0
Hi, I have this application I am developing that has a User Role "Supervisor". And I have to get a list of Supervisors names, in a dropdown or a reference selector so I can issue funds to them. I tried the generalization of System.user for my supervisors entity, and putting the xpath  [System.UserRoles = '[%UserRole_Supervisor%]'] In the select source of the reference selector. But when I run it in locally and on sandbox, when I clicked the reference selector, it shows a progress bar like thing, forever. And nothing happens, waited for more than 15 minutes. What seems to be wrong here? Please help Dilan
asked
4 answers
2

HI Dilan,

Mike covered it, it comes down to the security of your project and userroles.  If you want to allow a user to select the User Role Supervisor.  It comes down to the roles you want this to apply to.  Would all the users in the system need access or only the Supervisor Role?  You first need to grant them access to manage that User Role.  Let's say you have a Role of Manager and you want them to be able to manage the User Role Employee.  In the Project>Security under the tab User roles, select the User Role Manager and grant them rights to the User Role Employee.  In this example I'm granting the User Role Manager to manage the User Roles of Employee.  This way we can have them make the reference to the entity you choose.  You will need the association to the Account to accomplish this.

 

Also, for you code, you have id correct, you just need to allow the user rights to the User Role Supervisor.  Just use XPath on the Selectable Objects and add the XPath [System.UserRoles = '[%UserRole_Supervisor%]'].

 

Hope this helps,

Danny

answered
1

Dilan,

Entities and user roles are 2 different types of things in Mendix.  Your Supervisor entity provides you a way to create objects and store them in your database.  So you if your organization has 6 supervisors, you will create 6 Supervisor objects which will be stored in your database.  User roles are created in the project inside the modeler (via the Security menuin the Project Explorer) as you will see here:

User roles control what groups of users can access entities, microflows and pages within your application.  So it you create a Supervisor object, you'll also need to assign it User Role if you want that Supervisor to be able to log in.  You can assign user roles through the built in pages ( accessed via the Administration menu - edit a user and you'll see the capability to add user roles to a user), or you can create your own pages to do so.  For a more in depth description of security and user roles, see here: https://docs.mendix.com/refguide6/project-security

In order to get your Supervisors into a drop down (reference selector), you need to create the entity you will be associating Supervisors with (seems like maybe an entity called allocatedFunds or something similar), create an association from that entity to your Supervisor entity and add a Reference Selector to a page where you are editing allocatedFunds (inside a DataView, for instance).  Then point the Reference Selector to the association you created and you'll be good to go.  The reference selector will display all Supervisors for you to select from, in a drop down.

Hope that helps,

Mike

 

 

answered
0

To add an association across modules, you must open the owning entity of the association, navigate to the second tab for associations, and select the association through using the 'New' button. That will allow you to connect your Supervisor entity to the Account entity.

Mike and Danny and provided a lot of key information and we want to help you learn how to make it work optimally, but this should answer your direct question. 

answered
0

I do apologize for my mistake. For all in all my mistake was I have NOT associated my Entity with the Accounts Entity.

Instead what I have done is, I have created a separate entity named Supervisors and made that entity a specialization of the Accounts Entity. Then I have associated the created supervisor entity with the Funds Issue Entity.

I have learned from the hard way, that a Specialization of the Accounts Entity Will not get the created system users in a reference selector. 

You have to directly Associate the Accounts Entity with what ever your entity, to access the Users.

My mistake, And thanks everybody for helping.

Dilan

answered