How to create a user in the

How to create a user in the

  

Hi,

I'm creating an application that allows you to create a user within the application. When I try to create a user, it returns an error "UserManager role is required to create users". Can anyone help me figure out how to solve this problem? I'm new to Outsystems.

Please reply if have an idea.

Thanks,

Ralph

Hi Ralph.

The user the is actually logged in, need to have the role UserManager to create users in the User table.

You can provide this role to the user via application Users.
Or dynamically via code throught the GrantUserManagerRole and RevokeUserManagerRole actions. It is in the Users espace (module)

Eduardo Jauch wrote:

Hi Ralph.

The user the is actually logged in, need to have the role UserManager to create users in the User table.

You can provide this role to the user via application Users.
Or dynamically via code throught the GrantUserManagerRole and RevokeUserManagerRole actions. It is in the Users espace (module)

Hi Eduardo,

Thank you for replying. 

I just want to ask if I'm still going to create a server action containing the GrantUserManagerRole?; and

If ever that I need to create one, do I place it before the Create_User action or after?


Thanks,

Ralph


Hi Ralph.

You need to guarantee, to the user logged, that he has the role.
So, I would do something like this:

1. Grante Role.
2. Create New User
3. Revoke Role

Cheers,
Eduardo Jauch

P.S: The role UserManager is in the USers espace. Just add the reference to the role and the actions will become available in your module.

Eduardo Jauch wrote:

Hi Ralph.

You need to guarantee, to the user logged, that he has the role.
So, I would do something like this:

1. Grante Role.
2. Create New User
3. Revoke Role

Cheers,
Eduardo Jauch

Hi Eduardo,

Thank you for replying. I just did what you said in your previous comment. I created a new Server Action that will hold the GrantRole, CreateNewUser, and Revoke Role. Then, I encounter another problem for both the Roles and the CreateNewUser action that I needed UserID parameter on GrantRole and RevokeRole and a User Record for the Server Action. What UserID do I need and what User Record do I need?

Please reply,

Ralph

P.S: I'm really new to Outsystems and I really don't know what parameters that I need to use for this. I'm really hoping that you could help me with my application.

Hi Ralph,

If you are so new to OutSystems, I recommend you to do the Online Training (or a live class) before trying to develop.

In any case, you can pass to GrantRole and RevokeRole the GetUserId() function (it returns the ID of the user that is logged.

But for the CreateUser action, you need to have a record to provide to it. From a form, or a local variable, filled with the values you want to save in the database. Pay special attention to the PASSWORD, that must be hashed before saving.

Cheers,
Eduardo Jauch

Eduardo Jauch wrote:

Hi Ralph,

If you are so new to OutSystems, I recommend you to do the Online Training (or a live class) before trying to develop.

In any case, you can pass to GrantRole and RevokeRole the GetUserId() function (it returns the ID of the user that is logged.

But for the CreateUser action, you need to have a record to provide to it. From a form, or a local variable, filled with the values you want to save in the database. Pay special attention to the PASSWORD, that must be hashed before saving.

Cheers,
Eduardo Jauch

Hi Eduardo,

Thank you for replying. After piecing together and putting the necessary parameters, I was able to publish the module. Unfortunately, when I tried to create a user, I received another type of error. I attached a picture in this forum.

Can you please tell me what error this means?


Well,

You are working on a mobile application?
I'm not expert in mobile.

If you can share the code, I can take a look to understand the error. 

In the meantime, maybe someone more used to mobile apps may know what the error means.

Cheers,
Eduardo Jauch

Eduardo Jauch wrote:

Well,

You are working on a mobile application?
I'm not expert in mobile.

If you can share the code, I can take a look to understand the error. 

In the meantime, maybe someone more used to mobile apps may know what the error means.

Cheers,
Eduardo Jauch

Hi Eduardo,

Yes. I am working on a mobile application. I thought from the beginning you knew that I was working on a mobile application. I guess I didn't emphasize that in the post. That was my bad. Unfortunately, I can't share the code because this app is exclusive for the school that I'm currently enrolled and I'm still a student.

Anyway, do you know someone who is really expert in mobile application? I really need to get this job done.

Thanks,

Ralph


Hi Ralph,

There are lots of people that nows a lot of mobile application, here in the forum.
But I don't think they will be able to help without knowing how you are doing things...

The best you can do, right now, is really do the online training.

Cheers,
Eduardo Jauch

Eduardo Jauch wrote:

Hi Ralph,

There are lots of people that nows a lot of mobile application, here in the forum.
But I don't think they will be able to help without knowing how you are doing things...

The best you can do, right now, is really do the online training.

Cheers,
Eduardo Jauch

Hi Eduardo,

That might be the right thing to do right now, I guess. 

Anyway, I'm going to open another forum specifically for this error because I felt that I was almost there, getting the right output but had some errors. I noticed that the error has this DBO thing, it might have something to do about the database or the entity. Thanks for helping get to this point. The concept of the Master Roles having you explained it really helped me.


Thank you so much for replying. I really appreciate it.


Ralph


It was my pleasure, Ralph :)