Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Creating user with roles assignment

Avatar

Former Community Member

Hi,

I'm trying o create a user associating roles (using webservices).

First attempt:

Call the findUsers method and get the list of roles.

Associate the list of roles in the roleMembership propertie new user to be created.

The user is created but not associated to the roles.

Second attempt:

Use the ID of roles.

string[] _rolesList = new[]

                                                   {

                                                       "BASIC_ROLE_APPLICATION_ADMINISTRATOR",

                                                       "BASIC_ROLE_ADOBE_SERVICES_USER",

                                                       "WF.PROCESS.ADMIN",

                                                       "WF.PROCESS.DEV",

                                                       "BASIC_ROLE_RESOURCE_ADMIN",

                                                       "RIGHTS_MANAGEMENT_INVITE_EXTERNAL_USER",

                                                       "RIGHTS_MANAGEMENT_ADMINISTRATOR",

                                                       "BASIC_ROLE_SECURITY_ADMINISTRATOR",

                                                       "ROLE_READER_EXTENSIONS_WEB_APPLICATION",

                                                       "BASIC_ROLE_DOCUMENT_SERVICES_ADMINISTRATOR",

                                                       "RIGHTS_MANAGEMENT_POLICYSET_ADMINISTRATOR",

                                                       "RIGHTS_MANAGEMENT_ENDUSER_CONSOLE",

                                                       "RIGHTS_MANAGEMENT_MANAGE_INVITED_AND_LOCAL_USERS",

                                                       "BASIC_ROLE_ADMINISTRATOR",

                                                       "BASIC_ROLE_PROCESS_ADMIN",

                                                       "RIGHTS_MANAGEMENT_SUPERADMIN",

                                                       "BASIC_ROLE_TRUST_ADMINISTRATOR",

                                                       "CS_ROLE_ADMINISTRATOR"

                                                   };

object[] roleImpls = _rolesList.Select(roleId => new RoleImpl

                    {

                        id = roleId

                    }).ToArray();

                    UserImpl userImpl = new UserImpl

                    {

                        principalType = "USER",

                        domainName = xxx,

                        canonicalName = username,

                        commonName = username,

                        userid = xxx,

                        familyName = xxx,

                        givenName = xxx,

                        roleMembership = roleImpls

                    };

                    userOId = _dirService.createLocalUser(userImpl, password);

The user is created but not associated to the roles.

Informations:

I tried using create user and update user methods.


Method to create user = createLocalUser(UserImpl, password)

Method to update user = updateLocalUser(User, password)

Question:

How can I create a user (or update) associating to a list of roles?

Thanks!

Rodrigo Araújo

0 Replies