Skip to content

Commit

Permalink
Checkin.
Browse files Browse the repository at this point in the history
No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner committed Sep 8, 2023
1 parent 5064f87 commit 35eb6b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
15 changes: 12 additions & 3 deletions galaxy_ng/social/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def do_auth(self, access_token, *args, **kwargs):

v3_namespace = self.handle_v3_namespace(auth_response, email, login, gid)

'''
# create a legacynamespace?
legacy_namespace, _ = self._ensure_legacynamespace(login)
legacy_namespace, _ = self._ensure_legacynamespace(login, v3_namespace)

'''
# define namespace, validate and create ...
namespace_name = self.transform_namespace_name(login)
if self.validate_namespace_name(namespace_name):
Expand Down Expand Up @@ -185,11 +185,13 @@ def _ensure_namespace(self, namespace_name, user):

return namespace, created

def _ensure_legacynamespace(self, login):
def _ensure_legacynamespace(self, login, v3_namespace):
"""Create an auto legacynamespace for the account"""

'''
# userdata = id, login, access_token
user = User.objects.filter(username=login).first()
'''

# make the namespace
with transaction.atomic():
Expand All @@ -198,9 +200,16 @@ def _ensure_legacynamespace(self, login):
name=login
)

'''
# add the user to the owners
if created:
legacy_namespace.owners.add(user)
'''

# bind the v3 namespace
if created or not legacy_namespace.namespace:
legacy_namespace.namespace = v3_namespace
legacy_namespace.save()

return legacy_namespace, created

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,6 @@ def test_social_user_sync_with_changed_login(ansible_config):

# he should own a new v1 namespace too ...
ns_resp = admin_client('/api/v1/namespaces/?owner=sean-m-sullivan')

import epdb; epdb.st()
assert ns_resp['count'] == 2
v1_ns_names = [x['name'] for x in ns_resp['results']]
assert v1_ns_names == ['Wilk42', 'sean-m-sullivan']

0 comments on commit 35eb6b7

Please sign in to comment.