Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
95f16415
authored
Oct 16, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
acl: add AclBase.clone_acl
parent
d4c7fdc3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
circle/acl/models.py
+11
-0
No files found.
circle/acl/models.py
View file @
95f16415
...
...
@@ -71,6 +71,17 @@ class AclBase(Model):
"""Define permission levels for Users/Groups per object."""
object_level_set
=
GenericRelation
(
ObjectLevel
)
def
clone_acl
(
self
,
other
):
"""Clone full ACL from other object."""
assert
self
.
id
!=
other
.
id
or
type
(
self
)
!=
type
(
other
)
self
.
object_level_set
.
clear
()
for
i
in
other
.
object_level_set
.
all
():
ol
=
self
.
object_level_set
.
create
(
level
=
i
.
level
)
for
j
in
i
.
users
.
all
():
ol
.
users
.
add
(
j
)
for
j
in
i
.
groups
.
all
():
ol
.
groups
.
add
(
j
)
@classmethod
def
get_level_object
(
cls
,
level
):
...
...
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