Commit bbcd5f6a by Szabolcs Gelencser

Remove unnecessary parameters

parent 57b6f452
...@@ -466,29 +466,26 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin): ...@@ -466,29 +466,26 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
user=settings.OPENSTACK_CIRCLE_USERID 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() projects = self.__get_all_projects()
for p in projects: for p in projects:
if p.name == name: if p.name == name:
return p.id return p.id
return None return None
def __accept_membership(self, membership, project_id_of_user): def __accept_membership(self, project_id_of_user):
template = self.get_object() template = self.get_object()
glance = self.__get_glance_admin_client(project_id_of_user) glance = self.__get_glance_admin_client(project_id_of_user)
glance.image_members.update(template.image_id, project_id_of_user, 'accepted') glance.image_members.update(template.image_id, project_id_of_user, 'accepted')
def __handle_group_assignment(self, request): def __handle_group_assignment(self, request):
template = self.get_object() template = self.get_object()
pass
def __handle_user_assignment(self, request): def __handle_user_assignment(self, request):
glance = self.__get_glance_admin_client(request.user.tenant_id) glance = self.__get_glance_admin_client(request.user.tenant_id)
template = self.get_object() template = self.get_object()
new_template_user = request.POST['name'] new_template_user = request.POST['name']
project_id_of_user = self.__get_project_id_by_name( project_id_of_user = self.__get_project_id_by_name(new_template_user)
request, new_template_user
)
old_members_generator = glance.image_members.list(template.image_id) old_members_generator = glance.image_members.list(template.image_id)
old_members = [m.member_id for m in old_members_generator] old_members = [m.member_id for m in old_members_generator]
...@@ -498,7 +495,7 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin): ...@@ -498,7 +495,7 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
messages.warning(self.request, msg) messages.warning(self.request, msg)
elif project_id_of_user is not None: elif project_id_of_user is not None:
membership = glance.image_members.create(template.image_id, project_id_of_user) 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) msg = _("Successfully shared with %s" % new_template_user)
messages.success(self.request, msg) messages.success(self.request, msg)
else: 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