Skip to content

Can't set password for new user? #73

@mpope-tableau

Description

@mpope-tableau

Sorry if this is an old issue. (I searched but didn't find it.) I can create a new user this way:

new_user = server.users.add(name, siteRole)

The add function has this signature:

def add(self, user_item)

The UserItem constructor explicitly sets the password property like this:

def __init__(self, name, site_role, auth_setting=None):
        self._auth_setting = None
        self._domain_name = None
        self._external_auth_user_id = None
        self._id = None
        self._last_login = None
        self._name = None
        self._site_role = None
        self._workbooks = None
        self.email = None
        self.fullname = None
        self.password = None

And as near as I can tell (??) there is no setter in the UserItem class for a password property.

I tried doing this, which does compile and run:

new_user.password = args.newpassword
print("\nPassword changed to {0}".format(new_user.password))
new_user = server.users.update(new_user)

The server.users.update(new_user) call did result in a PUT request, but per Fiddler, the PUT request had only this in it (no password):

<tsRequest><user authSetting="ServerDefault" siteRole="SiteAdministrator" /></tsRequest>

In the UserRequest class (request_factory.py), there's a definition for an update_req method that would seem to take a password:

def update_req(self, user_item, password=''):
...
    if password:
        user_element.attrib['password'] = password

But I can't tell how to reach this method directly. So I'm stuck with being able to create a user but not assign a password. (And can't sign in as that user.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions