devopshq / devopshq/artifactory

Unable to manage group's users on Artifactory SaaS

Open
#431 2 comments 0 reactions 0 assignees View on GitHub
Bug Help Wanted
Dominant language
Python
Stars
306
Forks
161
PR merge metrics
No merged PRs in 30d

Description

I am using Artifactory SaaS and I am trying to create a group with users as specified in the [documentation](https://github.com/devopshq/artifactory/tree/5278d0686671c8dea0401a21c2d40b04d3e0ffb5#internal):

```python
from artifactory import ArtifactorySaaSPath
from dohq_artifactory import Group

artifactory_ = ArtifactorySaaSPath(
'https://mycompany.jfrog.io/artifactory',
apikey='myApiKey123'
)

group = artifactory_.find_group("groupname")

if group is None:
group = Group(artifactory_, "groupname")
group.create()

group.read()

group.users = ["admin", "anonymous"]
group.create()
```

The group is created but it has no user as members. I have found this working alternative though:

```python
from artifactory import ArtifactorySaaSPath
from dohq_artifactory import Group

artifactory_ = ArtifactorySaaSPath(
'https://mycompany.jfrog.io/artifactory',
apikey='myApiKey123'
)

group = artifactory_.find_group("groupname")

if group is None:
group = Group(artifactory_, "groupname")
group.create()

group.read()

for user in ["admin", "anonymous"]:
user = artifactory_.find_user(user)
user.add_to_group(group)
user.update()
```

But then I have the same problem again if I want to delete all group members:

```python
from artifactory import ArtifactorySaaSPath
from dohq_artifactory import Group

artifactory_ = ArtifactorySaaSPath(
'https://mycompany.jfrog.io/artifactory',
apikey='myApiKey123'
)

group = artifactory_.find_group("groupname")

if group is None:
group = Group(artifactory_, "groupname")
group.create()

group.read()

group.users = []
group.update() # group.create() has the same effect
```

The previously added users are not removed. I set every time `group.users` as a list, as required by the [source code](https://github.com/devopshq/artifactory/blob/5278d0686671c8dea0401a21c2d40b04d3e0ffb5/dohq_artifactory/admin.py#L471-L472), but that does not seem to work.

Has somebody else had the same issue? I am currently using `dohq-artifactory 0.9.0`. Thanks in advance

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.