Directly grant access to user creating the repository
authorSybren A. Stüvel <sybren@stuvel.eu>
Thu, 9 Nov 2017 16:36:52 +0000 (17:36 +0100)
committerSybren A. Stüvel <sybren@stuvel.eu>
Thu, 9 Nov 2017 16:36:52 +0000 (17:36 +0100)
svnman/__init__.py
svnman/routes.py

index 7a25fb4..11f1ccd 100644 (file)
@@ -232,6 +232,12 @@ class SVNManExtension(PillarExtension):
         eprops['repo_id'] = actual_repo_id
         proj_utils.put_project(proj)
 
+        # Make sure that the project object is updated as well.
+        if project.extension_props is None:
+            project.extension_props = {EXTENSION_NAME: pillarsdk.Resource()}
+
+        project.extension_props[EXTENSION_NAME].repo_id = actual_repo_id
+
         return actual_repo_id
 
     def _get_prop_props(self, project: pillarsdk.Project) -> (dict, dict):
index 6a56fee..16a544e 100644 (file)
@@ -106,7 +106,10 @@ def create_repo(project: pillarsdk.Project):
     log.info('going to create repository for project url=%r on behalf of user %s (%s)',
              project.url, current_user.user_id, current_user.email)
 
-    current_svnman.create_repo(project, f'{current_user.full_name} <{current_user.email}>')
+    repo_id = current_svnman.create_repo(project,
+                                         f'{current_user.full_name} <{current_user.email}>')
+    current_svnman.modify_access(project, repo_id, grant_user_id=str(current_user.user_id))
+
     return '', 204