Commits

Robert Myers  committed 45f9bec

fixing permission calling.

  • Participants
  • Parent commits dbec091
  • Branches worker

Comments (0)

Files changed (2)

File cannula/api/base/permissions.py

             group = api.groups.get(group)
         if project and not group:
             raise ApiError('Must pass a group with the project argument')
-        else:
+        elif project:
             project = api.projects.get(group, project)
         perm = self.get(perm)
-        return self._has_group_perm(user, perm, group, project, obj)
+        return self._has_perm(user, perm, group, project, obj)
     
     
     def grant_admin(self, user, group, project=None, req_user=None):

File cannula/api/base/projects.py

         """
         user = api.users.get(user)
         group = api.groups.get(group)
-        if not api.permissions.has_perm(user, group, perm):
+        if not api.permissions.has_perm(user, perm, group=group):
             raise PermissionError("User: %s does not have perm: %s" % (user, perm))
 
         # Check group members and remove inactive ones so we don't get errors
                     log.error("Error creating project, group: %s project: %s"
                               % (group, abbr))
                     log.error(format_exception())
-                    # We need to delete repositories that have been created
-                    try:
-                        project = api.projects.get(group, abbr)
-                        project.repo.delete_project(request.user)
-                    except:
-                        log.debug("Ignoring exception while attempting to delete"
-                                  " repo of failed create project action")
-                        log.debug(format_exception())
                     transaction.rollback()
                     # Explicitly specify the original exception instance here in
                     # case the repo deletion also raises an exception.