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
09081306
authored
Jul 16, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: simplify AclUpdateViews
parent
c61651af
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
28 deletions
+5
-28
circle/dashboard/views.py
+5
-28
No files found.
circle/dashboard/views.py
View file @
09081306
...
@@ -1135,22 +1135,9 @@ class TemplateAclUpdateView(AclUpdateView):
...
@@ -1135,22 +1135,9 @@ class TemplateAclUpdateView(AclUpdateView):
model
=
InstanceTemplate
model
=
InstanceTemplate
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
retval
=
super
(
TemplateAclUpdateView
,
self
)
.
post
(
request
,
*
args
,
**
kwargs
)
template
=
self
.
get_object
()
template
=
self
.
get_object
()
if
not
(
template
.
has_level
(
request
.
user
,
"owner"
)
or
getattr
(
template
,
'owner'
,
None
)
==
request
.
user
):
logger
.
warning
(
'Tried to set permissions of
%
s by non-owner
%
s.'
,
unicode
(
template
),
unicode
(
request
.
user
))
raise
PermissionDenied
()
name
=
request
.
POST
[
'perm-new-name'
]
if
(
User
.
objects
.
filter
(
username
=
name
)
.
count
()
+
Group
.
objects
.
filter
(
name
=
name
)
.
count
()
<
1
and
len
(
name
)
>
0
):
warning
(
request
,
_
(
'User or group "
%
s" not found.'
)
%
name
)
else
:
self
.
set_levels
(
request
,
template
)
self
.
add_levels
(
request
,
template
)
self
.
remove_levels
(
request
,
template
)
post_for_disk
=
request
.
POST
.
copy
()
post_for_disk
=
request
.
POST
.
copy
()
post_for_disk
[
'perm-new'
]
=
'user'
post_for_disk
[
'perm-new'
]
=
'user'
...
@@ -1160,24 +1147,14 @@ class TemplateAclUpdateView(AclUpdateView):
...
@@ -1160,24 +1147,14 @@ class TemplateAclUpdateView(AclUpdateView):
self
.
add_levels
(
request
,
d
)
self
.
add_levels
(
request
,
d
)
self
.
remove_levels
(
request
,
d
)
self
.
remove_levels
(
request
,
d
)
return
re
direct
(
template
)
return
re
tval
class
GroupAclUpdateView
(
AclUpdateView
):
class
GroupAclUpdateView
(
AclUpdateView
):
model
=
Group
model
=
Group
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
get_object
(
self
):
instance
=
self
.
get_object
()
.
profile
return
super
(
GroupAclUpdateView
,
self
)
.
get_object
()
.
profile
if
not
(
instance
.
has_level
(
request
.
user
,
"owner"
)
or
getattr
(
instance
,
'owner'
,
None
)
==
request
.
user
):
logger
.
warning
(
'Tried to set permissions of
%
s by non-owner
%
s.'
,
unicode
(
instance
),
unicode
(
request
.
user
))
raise
PermissionDenied
()
self
.
set_levels
(
request
,
instance
)
self
.
add_levels
(
request
,
instance
)
return
redirect
(
reverse
(
"dashboard.views.group-detail"
,
kwargs
=
self
.
kwargs
))
class
TemplateChoose
(
LoginRequiredMixin
,
TemplateView
):
class
TemplateChoose
(
LoginRequiredMixin
,
TemplateView
):
...
...
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