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
f7d27476
authored
7 years ago
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
acl: add CheckedObjectMixin
parent
c0cc0be1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
circle/acl/views.py
+11
-1
No files found.
circle/acl/views.py
View file @
f7d27476
...
...
@@ -15,4 +15,14 @@
# You should have received a copy of the GNU General Public License along
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
# Create your views here.
from
django.core.exceptions
import
PermissionDenied
class
CheckedObjectMixin
(
object
):
read_level
=
'user'
def
get_object
(
self
,
**
kwargs
):
obj
=
super
(
CheckedObjectMixin
,
self
)
.
get_object
()
if
not
obj
.
has_level
(
self
.
request
.
user
,
self
.
read_level
):
raise
PermissionDenied
()
return
obj
This diff is collapsed.
Click to expand it.
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