Commit bbcd5f6a by Szabolcs Gelencser

Remove unnecessary parameters

parent 57b6f452
......@@ -466,29 +466,26 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
user=settings.OPENSTACK_CIRCLE_USERID
)
def __get_project_id_by_name(self, request, name):
def __get_project_id_by_name(self, name):
projects = self.__get_all_projects()
for p in projects:
if p.name == name:
return p.id
return None
def __accept_membership(self, membership, project_id_of_user):
def __accept_membership(self, project_id_of_user):
template = self.get_object()
glance = self.__get_glance_admin_client(project_id_of_user)
glance.image_members.update(template.image_id, project_id_of_user, 'accepted')
def __handle_group_assignment(self, request):
template = self.get_object()
pass
def __handle_user_assignment(self, request):
glance = self.__get_glance_admin_client(request.user.tenant_id)
template = self.get_object()
new_template_user = request.POST['name']
project_id_of_user = self.__get_project_id_by_name(
request, new_template_user
)
project_id_of_user = self.__get_project_id_by_name(new_template_user)
old_members_generator = glance.image_members.list(template.image_id)
old_members = [m.member_id for m in old_members_generator]
......@@ -498,7 +495,7 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
messages.warning(self.request, msg)
elif project_id_of_user is not None:
membership = glance.image_members.create(template.image_id, project_id_of_user)
self.__accept_membership(membership, project_id_of_user)
self.__accept_membership(project_id_of_user)
msg = _("Successfully shared with %s" % new_template_user)
messages.success(self.request, msg)
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment