Jump to content

How to assign more than one role.


javi_123

Recommended Posts

Hi All,

I need to assign more than one role when a new user is created.

By default, ROLE_USER role is assigned when a new user is created.

I have looked at applicationContext.xml, where the default role is set to ROLE_USER:

<property name="defaultRole" value="ROLE_USER"/>

I want to add ROLE_USER and ROLE_DEMO as a default role when a new user is created. Have tried so many option but no result;(

Please reply back with the solution.

Regards

Javi

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Are you creating the users programatically? Or do you just want to have the default setup for a new user - when the Administrative user is managing users - to have both roles automatically assigned by default so that there are less clicks needed by the Administrator to set up a new user?

 

And are you using LDAP?

Link to comment
Share on other sites

Thanks a lot for your the suggessions. I have finally managed to get it working.

I have added the follwing code in the userCreator.js file:

if (defaultRole) {

            user.roles.push({roleName : defaultRole}) &&
   user.roles.push({roleName : 'ROLE_LICENSE'});
        }

 Regards

Javed

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...