Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bbcd5f6a
authored
May 31, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary parameters
parent
57b6f452
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
circle/dashboard/views/util.py
+4
-7
No files found.
circle/dashboard/views/util.py
View file @
bbcd5f6a
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment