Skip to content

Commit

Permalink
Handle Role restriction for Partner Dashboard (#26)
Browse files Browse the repository at this point in the history
* Handle Role restriction for Partner Dashboard

* Update condition

* fix pylint
  • Loading branch information
ashwin1111 authored Dec 13, 2022
1 parent eebbddb commit 738e66f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion fyle_rest_auth/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ def get_fyle_admin(access_token: str, origin_address: str = None) -> Dict:
profile_api_url = '{}/platform/v1beta/spender/my_profile'.format(cluster_domain)
employee_detail = get_request(profile_api_url, access_token, origin_address)

if 'ADMIN' in employee_detail['data']['roles']:
if 'ADMIN' in employee_detail['data']['roles'] or \
('FYLE_MODULE' in settings.FYLE_REST_AUTH_SERIALIZERS and \
settings.FYLE_REST_AUTH_SERIALIZERS['FYLE_MODULE'] == 'PARTNER_DASHBOARD'):
return employee_detail
else:
raise Exception('User is not an admin')
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name='fyle-rest-auth',
version='1.1.0',
version='1.2.0',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Django application to implement OAuth 2.0 using Fyle in Django rest framework',
Expand Down

0 comments on commit 738e66f

Please sign in to comment.