Skip to content

Commit

Permalink
Merge pull request #15 from whdalsrnt/master
Browse files Browse the repository at this point in the history
Add RBAC features
  • Loading branch information
whdalsrnt authored Feb 1, 2021
2 parents 0a8938a + 23f3ba9 commit 30375d0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/spaceone/config/conf/global_conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DATABASE_AUTO_CREATE_INDEX = True
DATABASE_SUPPORT_AWS_DOCUMENT_DB = False
DATABASE_CASE_INSENSITIVE_INDEX = False
DATABASES = {
'default': {
'db': 'config',
Expand Down
12 changes: 6 additions & 6 deletions src/spaceone/config/service/domain_config_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.domain_config_mgr: DomainConfigManager = self.locator.get_manager('DomainConfigManager')

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['name', 'data', 'domain_id'])
def create(self, params):
"""Create config map
Expand All @@ -35,7 +35,7 @@ def create(self, params):

return self.domain_config_mgr.create_domain_config(params)

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['name', 'domain_id'])
def update(self, params):
"""Update config map
Expand All @@ -54,7 +54,7 @@ def update(self, params):
"""
return self.domain_config_mgr.update_domain_config(params)

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['name', 'domain_id'])
def delete(self, params):
"""Delete config map
Expand All @@ -71,7 +71,7 @@ def delete(self, params):

self.domain_config_mgr.delete_domain_config(params['name'], params['domain_id'])

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['name', 'domain_id'])
def get(self, params):
"""Get config map
Expand All @@ -89,7 +89,7 @@ def get(self, params):

return self.domain_config_mgr.get_domain_config(params['name'], params['domain_id'], params.get('only'))

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['domain_id'])
@append_query_filter(['name', 'domain_id'])
@change_tag_filter('tags')
Expand All @@ -112,7 +112,7 @@ def list(self, params):
query = params.get('query', {})
return self.domain_config_mgr.list_domain_configs(query)

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['query', 'domain_id'])
@append_query_filter(['domain_id'])
@change_tag_filter('tags')
Expand Down
12 changes: 6 additions & 6 deletions src/spaceone/config/service/user_config_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.user_config_mgr: UserConfigManager = self.locator.get_manager('UserConfigManager')

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['name', 'data', 'domain_id'])
def create(self, params):
"""Create config map
Expand All @@ -34,7 +34,7 @@ def create(self, params):

return self.user_config_mgr.create_user_config(params)

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['name', 'domain_id'])
def update(self, params):
"""Update config map
Expand All @@ -52,7 +52,7 @@ def update(self, params):
"""
return self.user_config_mgr.update_user_config(params)

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['name', 'domain_id'])
def delete(self, params):
"""Delete config map
Expand All @@ -69,7 +69,7 @@ def delete(self, params):

self.user_config_mgr.delete_user_config(params['name'], params['domain_id'])

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['name', 'domain_id'])
def get(self, params):
"""Get config map
Expand All @@ -87,7 +87,7 @@ def get(self, params):

return self.user_config_mgr.get_user_config(params['name'], params['domain_id'], params.get('only'))

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['domain_id'])
@append_query_filter(['name', 'domain_id'])
@change_tag_filter('tags')
Expand All @@ -110,7 +110,7 @@ def list(self, params):
query = params.get('query', {})
return self.user_config_mgr.list_user_configs(query)

@transaction
@transaction(append_meta={'authorization.scope': 'DOMAIN'})
@check_required(['query', 'domain_id'])
@append_query_filter(['domain_id'])
@change_tag_filter('tags')
Expand Down
2 changes: 0 additions & 2 deletions test/service/test_domain_config_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class TestDomainConfigService(unittest.TestCase):
@classmethod
def setUpClass(cls):
config.init_conf(package='spaceone.config')
config.set_service_config()
config.set_global(DATABASE_SUPPORT_AWS_DOCUMENT_DB=True)
connect('test', host='mongomock://localhost')

cls.domain_id = utils.generate_id('domain')
Expand Down
2 changes: 0 additions & 2 deletions test/service/test_user_config_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class TestUserConfigService(unittest.TestCase):
@classmethod
def setUpClass(cls):
config.init_conf(package='spaceone.config')
config.set_service_config()
config.set_global(DATABASE_SUPPORT_AWS_DOCUMENT_DB=True)
connect('test', host='mongomock://localhost')

cls.domain_id = utils.generate_id('domain')
Expand Down

0 comments on commit 30375d0

Please sign in to comment.