How can I use User_GrantRole Action?

Hi all.


Does anyone know how to use User_GrantRole Action which usersLocalManagement extension?


What I'm trying to do is granting the specific role which is work as default role to the Logged in User.

User_GrantRole requieres UserId(Integer Identifier type) and RoleId(Integer Identifier type).

When debugging,  I can see these Id have correct value but every time passing the User_GrantRole, it throws following Exception.

System.TypeInitializationException:


Does anyone know what is the cause?

Is it impossible to use usersLocalManagement extension?


Thanks in advance.

Solution

Hi Yukiya,

I was able to reproduce this issue, so it seems like it's a bug in the UsersLocalManagement extension. I would contact Outsystems support if I were you.

Meanwhile, there's an alternative way to grant a role to a user. Add a reference to the "User_Role" entity from the System module and then use the "CreateUser_Role" entity action to grant the Role:

Solution

Hi,

Please note that the Roles have 3 actions (Check, Grant and Revoke) that allow you to check if a user has that specific role. Grant/give that role to a user or Revoke/Remove that role.

Yukiya Miyamoto wrote:

Hi all.


Does anyone know how to use User_GrantRole Action which usersLocalManagement extension?


What I'm trying to do is granting the specific role which is work as default role to the Logged in User.

User_GrantRole requieres UserId(Integer Identifier type) and RoleId(Integer Identifier type).

When debugging,  I can see these Id have correct value but every time passing the User_GrantRole, it throws following Exception.

System.TypeInitializationException:


Does anyone know what is the cause?

Is it impossible to use usersLocalManagement extension?


Thanks in advance.

Hi,


As Nuno saying, you have 2 ways to use the actions, drag + drop to a flow or you can use directly in If (p.e) because this actions is a Functions too.

Cheers,

Thiago S. Mari


Aurelio Junior wrote:

Hi Yukiya,

I was able to reproduce this issue, so it seems like it's a bug in the UsersLocalManagement extension. I would contact Outsystems support if I were you.

Meanwhile, there's an alternative way to grant a role to a user. Add a reference to the "User_Role" entity from the System module and then use the "CreateUser_Role" entity action to grant the Role:



Thank you for your reply, Aurelio.

Maybe I'm going to go with this way,

I'm just wondering if I can operate the User's role from Users Application...

I'll check that! 


Regards.

Nuno Rolo wrote:

Hi,

Please note that the Roles have 3 actions (Check, Grant and Revoke) that allow you to check if a user has that specific role. Grant/give that role to a user or Revoke/Remove that role.

Thank you for your reply.

I'll check those actions!


Regards.


Thiago Mari wrote:

Yukiya Miyamoto wrote:

Hi all.


Does anyone know how to use User_GrantRole Action which usersLocalManagement extension?


What I'm trying to do is granting the specific role which is work as default role to the Logged in User.

User_GrantRole requieres UserId(Integer Identifier type) and RoleId(Integer Identifier type).

When debugging,  I can see these Id have correct value but every time passing the User_GrantRole, it throws following Exception.

System.TypeInitializationException:


Does anyone know what is the cause?

Is it impossible to use usersLocalManagement extension?


Thanks in advance.

Hi,


As Nuno saying, you have 2 ways to use the actions, drag + drop to a flow or you can use directly in If (p.e) because this actions is a Functions too.

Cheers,

Thiago S. Mari


Thank you for your reply.

I'll check those functions more.



Regards.


I'm just wondering if I can operate the User's role from Users Application...

You definitely can. In the Users application, if you open the details of a user, you'll see a "Roles" section where you can grant and revoke roles for that user.

Aurelio Junior wrote:

I'm just wondering if I can operate the User's role from Users Application...

You definitely can. In the Users application, if you open the details of a user, you'll see a "Roles" section where you can grant and revoke roles for that user.

Thank you very much.

I managed to realize what i wanted to do.


Best regards.


Yukiya Miyamoto wrote:

Thiago Mari wrote:

Yukiya Miyamoto wrote:

Hi all.


Does anyone know how to use User_GrantRole Action which usersLocalManagement extension?


What I'm trying to do is granting the specific role which is work as default role to the Logged in User.

User_GrantRole requieres UserId(Integer Identifier type) and RoleId(Integer Identifier type).

When debugging,  I can see these Id have correct value but every time passing the User_GrantRole, it throws following Exception.

System.TypeInitializationException:


Does anyone know what is the cause?

Is it impossible to use usersLocalManagement extension?


Thanks in advance.

Hi,


As Nuno saying, you have 2 ways to use the actions, drag + drop to a flow or you can use directly in If (p.e) because this actions is a Functions too.

Cheers,

Thiago S. Mari


Thank you for your reply.

I'll check those functions more.



Regards.


Hi,


You already made? need some help?


Cheers,

Thiago S. Mari


Thiago Mari wrote:

Yukiya Miyamoto wrote:

Thiago Mari wrote:

Yukiya Miyamoto wrote:

Hi all.


Does anyone know how to use User_GrantRole Action which usersLocalManagement extension?


What I'm trying to do is granting the specific role which is work as default role to the Logged in User.

User_GrantRole requieres UserId(Integer Identifier type) and RoleId(Integer Identifier type).

When debugging,  I can see these Id have correct value but every time passing the User_GrantRole, it throws following Exception.

System.TypeInitializationException:


Does anyone know what is the cause?

Is it impossible to use usersLocalManagement extension?


Thanks in advance.

Hi,


As Nuno saying, you have 2 ways to use the actions, drag + drop to a flow or you can use directly in If (p.e) because this actions is a Functions too.

Cheers,

Thiago S. Mari


Thank you for your reply.

I'll check those functions more.



Regards.


Hi,


You already made? need some help?


Cheers,

Thiago S. Mari



Hi, Thiago Mari.


I've already made!

Thank you!

Yukiya Miyamoto wrote:

Thiago Mari wrote:

Yukiya Miyamoto wrote:

Thiago Mari wrote:

Yukiya Miyamoto wrote:

Hi all.


Does anyone know how to use User_GrantRole Action which usersLocalManagement extension?


What I'm trying to do is granting the specific role which is work as default role to the Logged in User.

User_GrantRole requieres UserId(Integer Identifier type) and RoleId(Integer Identifier type).

When debugging,  I can see these Id have correct value but every time passing the User_GrantRole, it throws following Exception.

System.TypeInitializationException:


Does anyone know what is the cause?

Is it impossible to use usersLocalManagement extension?


Thanks in advance.

Hi,


As Nuno saying, you have 2 ways to use the actions, drag + drop to a flow or you can use directly in If (p.e) because this actions is a Functions too.

Cheers,

Thiago S. Mari


Thank you for your reply.

I'll check those functions more.



Regards.


Hi,


You already made? need some help?


Cheers,

Thiago S. Mari



Hi, Thiago Mari.


I've already made!

Thank you!

Hi,

No problem


Hope to help,

Thiago S. Mari