Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to manage group's users on Artifactory SaaS #431

Open
vittoriocanilli opened this issue Aug 31, 2023 · 0 comments
Open

Unable to manage group's users on Artifactory SaaS #431

vittoriocanilli opened this issue Aug 31, 2023 · 0 comments
Labels
Bug Help Wanted We will be glad if somebody proposes a solution via PR

Comments

@vittoriocanilli
Copy link

vittoriocanilli commented Aug 31, 2023

I am using Artifactory SaaS and I am trying to create a group with users as specified in the documentation:

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:

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:

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, 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

@allburov allburov added Bug Help Wanted We will be glad if somebody proposes a solution via PR labels Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Help Wanted We will be glad if somebody proposes a solution via PR
Development

No branches or pull requests

2 participants