Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service API ponctual permissions #109

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ Credits
Development Lead
----------------

* Francois-Xavier <francois-xavier.derue@crim.ca>
* Francis Charette Migneault <francis.charette-migneault@crim.ca>

Contributors
------------

* David Byrns <[email protected]>
* David Caron <[email protected]>
* Francis Charette Migneault <[email protected]>
* Francois-Xavier Derue <[email protected]>
10 changes: 10 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
History
=======

0.7.x
---------------------

`Magpie REST API latest documentation`_

* add service resource auto-sync feature
* return user/group services if any sub-resource has permissions
* [WIP] add inherited resource permission with querystring (deprecate `inherited_<>` routes)

0.6.x
---------------------

Expand Down Expand Up @@ -97,3 +106,4 @@ History
.. _Magpie REST API 0.4.x documentation: magpie_api_0.4.x_
.. _Magpie REST API 0.5.x documentation: magpie_api_0.5.x_
.. _Magpie REST API 0.6.x documentation: magpie_api_0.6.x_
.. _Magpie REST API latest documentation: _magpie_api_latest
2 changes: 1 addition & 1 deletion magpie/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
General meta information on the magpie package.
"""

__version__ = '0.6.5-dev'
__version__ = '0.7.0'
__author__ = "Francois-Xavier Derue, Francis Charette-Migneault"
__maintainer__ = "Francis Charette-Migneault"
__email__ = '[email protected]'
Expand Down
2 changes: 1 addition & 1 deletion magpie/adapter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from magpie.db import *
from magpie import __meta__
import logging
logger = logging.getLogger(__name__)
logger = logging.getLogger("TWITCHER")


class MagpieAdapter(AdapterInterface):
Expand Down
Empty file added magpie/adapter/magpieprocess.py
Empty file.
5 changes: 3 additions & 2 deletions magpie/adapter/magpieservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import requests
import json
LOGGER = logging.getLogger(__name__)
LOGGER = logging.getLogger("TWITCHER")

from magpie.definitions.twitcher_definitions import *
from magpie.definitions.pyramid_definitions import ConfigurationError
Expand Down Expand Up @@ -48,7 +48,8 @@ def list_services(self, request=None):
Lists all services registered in magpie.
"""
my_services = []
response = requests.get('{url}/users/current/services'.format(url=self.magpie_url),
path = '/users/current/services?inherit=True&cascade=True'
response = requests.get('{url}{path}'.format(url=self.magpie_url, path=path),
cookies=request.cookies)
if response.status_code != 200:
raise response.raise_for_status()
Expand Down
10 changes: 10 additions & 0 deletions magpie/api/api_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,13 @@ def get_value_matchdict_checked(request, key):
verify_param(val, notNone=True, notEmpty=True, httpError=HTTPUnprocessableEntity,
paramName=key, msgOnFail=UnprocessableEntityResponseSchema.description)
return val


def get_query_param(request, case_insensitive_key, default=None):
for p in request.params:
if p.lower() == case_insensitive_key:
value = request.params.get(p)
if isinstance(value, six.string_types):
return value.lower()
return value
return default
Loading