Allow non admin user to create and see tickets

Change-Id: Iffc7ae2e60b6752a7c73176e8cbb283d10b78f6f
This commit is contained in:
Anthony Michon 2015-08-05 13:58:58 +02:00
parent 836c035096
commit 4cf1e3ee11
6 changed files with 36 additions and 19 deletions

View File

@ -2,12 +2,14 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=0.6,!=0.7,<1.0
pbr<2.0,>=1.3
Babel>=1.3
python-redmine
paste
pecan>=0.4.5
oslo.messaging>=1.3.0,<=1.4.1
oslo.config>=1.4.0 # Apache-2.0
python-keystoneclient>=0.4.2,<0.12
WSME>=0.6
pecan>=0.8.0
oslo.messaging>=1.3.0,<1.5
oslo.config>=1.11.0,<=1.15.0 # Apache-2.0
oslo.utils<2.0.0
oslo.serialization<1.7.0
python-keystoneclient>=1.6.0
WSME>=0.7

11
setup.py Executable file → Normal file
View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -17,6 +16,14 @@
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr'],
setup_requires=['pbr>=1.3'],
pbr=True)

View File

@ -24,4 +24,5 @@ app = {
'debug': True,
'enable_acl': False,
'acl_public_routes': ['/', '/v1'],
'member_routes': ['/v1/ticket', ]
}

View File

@ -88,8 +88,16 @@ class AdminAuthHook(hooks.PecanHook):
rejects the request if the api is not public.
"""
def is_path_in_routes(self, path):
for p in self.member_routes:
if path.startswith(p):
return True
return False
def before(self, state):
ctx = state.request.context
if not ctx.is_admin and not ctx.is_public_api:
raise exc.HTTPForbidden()
if not ctx.is_admin and not ctx.is_public_api and \
not self.is_path_in_routes(state.request.path):
raise exc.HTTPForbidden()

View File

@ -68,7 +68,7 @@ class TrackingBase(object):
def _has_sticks_role(self, user_id, role_id, project_id):
"""
Evaluates whether this user has ikare role. Returns
Evaluates whether this user has sticks role. Returns
``True`` or ``False``.
"""
if self.kc is None:

View File

@ -2,21 +2,20 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=0.9.2,<0.10
hacking<0.10,>=0.9.2
# mock object framework
mock>=1.0
mock>=1.2
coverage>=3.6
discover
# fixture stubbing
fixtures>=0.3.14
oslotest>=1.1.0 # Apache-2.0
python-subunit
junitxml
fixtures>=1.3.1
oslotest>=1.10.0 # Apache-2.0
python-subunit>=0.0.18
nose
nose-exclude
nosexcover
# Doc requirements
sphinx>=1.1.2,!=1.2.0,<1.3
oslosphinx
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
oslosphinx>=2.5.0 # Apache-2.0
sphinxcontrib-httpdomain
sphinxcontrib-pecanwsme>=0.8