示例#1
0
    def create_user(self, context, **kwargs):
        scim = self._denormalize(kwargs, context['path'])
        user = conv.user_scim2key(scim, path=context['path'])
        ref = super(ScimUserV3Controller, self).create_user(context, user=user)

        if ref.get('user', None):
            user_id = ref.get('user', None)['id']
            # create user's associated project
            project = {
                'name':user_id,
                'domain_id':ref.get('user', None)['domain_id'],
                'enabled': True,
                'is_default': True,
            }
            project_ref = self._assign_unique_id(self._normalize_dict(project))
            project_ref = self._normalize_domain_id(context, project_ref)
            project_ref = self.assignment_api.create_project(
                project_ref['id'], project_ref)

            # assign default role to new user in their associated project
            default_role = self.registration_api.get_default_role()
            self.assignment_api.create_grant(default_role['id'], 
                                             user_id=user_id,
                                             project_id=project_ref['id'])
            
            # store default_project_id and username
            user['default_project_id'] = project_ref['id']
            user['username'] = user_id
            ref = super(ScimUserV3Controller, self).update_user(context, user_id=user_id, user=user)

        return conv.user_key2scim(ref.get('user', None), path=context['path'])
示例#2
0
 def patch_user(self, context, user_id, **kwargs):
     scim = self._denormalize(kwargs, context['path'])
     user = conv.user_scim2key(scim, path=context['path'])
     ref = super(ScimUserV3Controller, self).update_user(context,
                                                         user_id=user_id,
                                                         user=user)
     return conv.user_key2scim(ref.get('user', None), path=context['path'])
    def create_user(self, context, **kwargs):
        scim = self._denormalize(kwargs, context['path'])
        user = conv.user_scim2key(scim, path=context['path'])
        ref = super(ScimUserV3Controller, self).create_user(context, user=user)

        if ref.get('user', None):
            user_id = ref.get('user', None)['id']
            # create user's associated project
            project = {
                'name': user_id,
                'domain_id': ref.get('user', None)['domain_id'],
                'enabled': True,
                'is_default': True,
            }
            project_ref = self._assign_unique_id(self._normalize_dict(project))
            project_ref = self._normalize_domain_id(context, project_ref)
            project_ref = self.assignment_api.create_project(
                project_ref['id'], project_ref)

            # assign default role to new user in their associated project
            default_role = self.registration_api.get_default_role()
            self.assignment_api.create_grant(default_role['id'],
                                             user_id=user_id,
                                             project_id=project_ref['id'])

            # store default_project_id and username
            user['default_project_id'] = project_ref['id']
            user['username'] = user_id
            ref = super(ScimUserV3Controller,
                        self).update_user(context, user_id=user_id, user=user)

        return conv.user_key2scim(ref.get('user', None), path=context['path'])
示例#4
0
 def patch_user(self, context, user_id, **kwargs):
     scim = self._denormalize(kwargs, context["path"])
     user = conv.user_scim2key(scim, path=context["path"])
     ref = super(ScimUserV3Controller, self).update_user(context, user_id=user_id, user=user)
     return conv.user_key2scim(ref.get("user", None), path=context["path"])
示例#5
0
 def get_user(self, context, user_id):
     ref = super(ScimUserV3Controller, self).get_user(context, user_id=user_id)
     return conv.user_key2scim(ref["user"], path=context["path"])
示例#6
0
 def get_user(self, context, user_id):
     ref = super(ScimUserV3Controller, self).get_user(context,
                                                      user_id=user_id)
     return conv.user_key2scim(ref['user'], path=context['path'])
 def create_user(self, context, **kwargs):
     scim = self._denormalize(kwargs)
     user = conv.user_scim2key(scim)
     ref = super(ScimUserV3Controller, self).create_user(context, user=user)
     return conv.user_key2scim(ref.get('user', None))
 def get_user(self, context, user_id):
     ref = super(ScimUserV3Controller, self).get_user(
         context, user_id=user_id)
     return conv.user_key2scim(ref['user'])
 def create_user(self, context, **kwargs):
     scim = self._denormalize(kwargs)
     user = conv.user_scim2key(scim)
     ref = super(ScimUserV3Controller, self).create_user(context, user=user)
     return conv.user_key2scim(ref.get('user', None))