Skip to content

Commit

Permalink
Merge pull request #109 from mathis-lab/fix-create-user
Browse files Browse the repository at this point in the history
Fix create_user issue
  • Loading branch information
iamtekson authored Apr 30, 2023
2 parents fbc234f + 1aba87f commit 0b41829
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions geo/Geoserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2323,14 +2323,15 @@ def get_all_users(self, service=None):
except Exception as e:
raise Exception(e)

def create_user(self, username: str, password: str, enabled=True, service=None):
def create_user(self, username: str, password: str, enabled: bool = True, service=None):
"""
Parameters
----------
username : str
password: str
user_service : str, optional
enabled: bool
service : str, optional
Add a new user to the provided user/group service
If no user/group service is provided, then the users is added to default user service
Expand All @@ -2343,7 +2344,7 @@ def create_user(self, username: str, password: str, enabled=True, service=None):
url += "service/{}/users/".format(service)

data = "<user><userName>{}</userName><password>{}</password><enabled>{}</enabled></user>".format(
username, password, enabled
username, password, str(enabled).lower()
)
headers = {"content-type": "text/xml", "accept": "application/json"}
r = requests.post(
Expand Down

0 comments on commit 0b41829

Please sign in to comment.