Files
distcloud/distributedcloud/dcdbsync/api/controllers/v1/identity/root.py
Jessica Castelino 8ed5018d8b Support identity groups in DC
This commit supports synchronization of Identity Group Resource
from central cloud to subclouds. The dcorch audit makes use of
dbsync service to handle creation, modification and deletion of
the groups and the user group memberships. It also handles the
the grant and revocation of group role assignments.

Tests executed:

1) Initial sync
- Verify in subcloud DB that users, groups,user-group
  memberships and project assignments are synced as expected
- Add/Delete new users to existing subcloud groups
- Add/Delete role assigments for existing subcloud groups
- Update group information for existing subcloud groups
- Update information of existing users belonging to existing
  groups
- Verify behaviour on subclouds which have additional
  identity groups (i.e. superset of SystemController);
  which may have been created by admin user for that subcloud

2) Execute all the above test cases as a part of dcorch audit

3) Execute all the above test cases using proxy

4) Execute all the above test cases in a larger env

Change-Id: Ic6c5794be39ec93edc769e72b2a2d53eaba3ecc3
Signed-off-by: Jessica Castelino <jessica.castelino@windriver.com>
Closes-Bug: 1942939
2021-09-23 15:10:38 -04:00

65 lines
2.0 KiB
Python

# Copyright (c) 2017 Ericsson AB.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Copyright (c) 2019-2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from oslo_config import cfg
from oslo_log import log as logging
import pecan
from dcdbsync.api.controllers.v1.identity import identity
from dcdbsync.api.controllers.v1.identity import project
from dcdbsync.api.controllers.v1.identity import role
from dcdbsync.api.controllers.v1.identity import token_revoke_event
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
class IdentityController(object):
def _get_resource_controller(self, remainder):
if not remainder:
pecan.abort(404)
return
res_controllers = dict()
res_controllers["users"] = identity.UsersController
res_controllers["groups"] = identity.GroupsController
res_controllers["projects"] = project.ProjectsController
res_controllers["roles"] = role.RolesController
res_controllers["token-revocation-events"] = \
token_revoke_event.RevokeEventsController
for name, ctrl in res_controllers.items():
setattr(self, name, ctrl)
resource = remainder[0]
if resource not in res_controllers:
pecan.abort(404)
return
remainder = remainder[1:]
return res_controllers[resource](), remainder
@pecan.expose()
def _lookup(self, *remainder):
return self._get_resource_controller(remainder)