diff options
author | maxbr <maxbr@mi.fu-berlin.de> | 2016-07-29 12:43:43 +0200 |
---|---|---|
committer | Max Breitenfeldt <max.breitenfeldt@gmail.com> | 2016-07-29 11:25:20 +0000 |
commit | 35c34c690ae9616d791c39fa218fe1621fa8d8d2 (patch) | |
tree | 6168caaeb4be9144ed6bfde0150850d6559c8b6f /tools/pharos-dashboard/dashboard/views/registration.py | |
parent | 7ae1f204de947a3c12804c04f32e20d45eb99eba (diff) |
import pharos dashboard code
JIRA: RELENG-12
The last commit was missing some JS/CSS dependencies of the site. This
happened because they are in folders that are named 'build' or 'dist'.
This commit adds a bower.json file, that specifies dependencies.
Dependencies can now be installed by running 'bower install' in the
dashboard/static folder.
Change-Id: I054f319c66771f767e97711cb678d79d3bd6bee4
Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'tools/pharos-dashboard/dashboard/views/registration.py')
-rw-r--r-- | tools/pharos-dashboard/dashboard/views/registration.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/pharos-dashboard/dashboard/views/registration.py b/tools/pharos-dashboard/dashboard/views/registration.py new file mode 100644 index 00000000..516fb298 --- /dev/null +++ b/tools/pharos-dashboard/dashboard/views/registration.py @@ -0,0 +1,16 @@ +from django.contrib.auth.mixins import UserPassesTestMixin + + +class BookingUserTestMixin(UserPassesTestMixin): + # Test if a user has permission to book this Pod + def test_func(self): + user = self.request.user + # Check if User is troubleshooter / admin + if user.has_perm(('dashboard.add_booking')): + return True + # Check if User owns this resource + user_resources = user.userresource_set.get_queryset() + for user_resource in user_resources: + if user_resource.resource_id == self.resource.resource_id: + return True + return False |