splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

Supplying multiple roles when creating an User

Open parhamfh opened this issue 14 years ago • 2 comments

This is related to issue #32.

When creating a User you must provide a role too: admin or user for instance. As specified in http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTaccess#authentication.2Fusers under the header "POST authentication/users" which describes creation of a user, you can also specify a list of roles:

"... To assign multiple roles, send them in separate roles parameters."

that means writing something like -d roles=admin -d roles=user. This obviously will not work in our python implementation seeing as we are using a dict. I tried experimenting with different ways of supplying both the roles in one -d roles=-option using & , ; and {}. [] but couldn't figure it out. So I assume you must supply separate roles options.

Do you guys have any idea of how to fix/work around this?

parhamfh avatar May 15 '12 11:05 parhamfh

You should be able to pass an array. So services.users.create(..., roles=['admin', 'power'])

itay avatar May 15 '12 15:05 itay

The answer was more obvious than I first believed, thank you Itay!

parhamfh avatar May 15 '12 20:05 parhamfh