예제 #1
0
파일: user.py 프로젝트: Cerberus98/keystone
 def user_roles_by_tenant(self, user_id, tenant_id, session=None):
     if not session:
         session = get_session()
     result = session.query(models.UserRoleAssociation).\
         filter_by(user_id=user_id, tenant_id=tenant_id).\
         options(joinedload('roles'))
     return result
예제 #2
0
파일: user.py 프로젝트: wendy-king/x7_venv
 def user_roles_by_tenant(self, user_id, tenant_id, session=None):
     if not session:
         session = get_session()
     result = session.query(models.UserRoleAssociation).\
         filter_by(user_id=user_id, tenant_id=tenant_id).\
         options(joinedload('roles'))
     return result
예제 #3
0
    def user_roles_by_tenant(self, user_id, tenant_id, session=None):
        if not session:
            session = get_session()

        if hasattr(api.USER, 'uid_to_id'):
            user_id = api.USER.uid_to_id(user_id)
        if hasattr(api.TENANT, 'uid_to_id'):
            tenant_id = api.TENANT.uid_to_id(tenant_id)

        results = session.query(models.UserRoleAssociation).\
            filter_by(user_id=user_id, tenant_id=tenant_id).\
            options(joinedload('roles'))

        for result in results:
            if hasattr(api.USER, 'id_to_uid'):
                result.user_id = api.USER.id_to_uid(result.user_id)
            if hasattr(api.TENANT, 'id_to_uid'):
                result.tenant_id = api.TENANT.id_to_uid(result.tenant_id)

        return results
예제 #4
0
    def user_roles_by_tenant(self, user_id, tenant_id, session=None):
        if not session:
            session = get_session()

        if hasattr(api.USER, 'uid_to_id'):
            user_id = api.USER.uid_to_id(user_id)
        if hasattr(api.TENANT, 'uid_to_id'):
            tenant_id = api.TENANT.uid_to_id(tenant_id)

        results = session.query(models.UserRoleAssociation).\
            filter_by(user_id=user_id, tenant_id=tenant_id).\
            options(joinedload('roles'))

        for result in results:
            if hasattr(api.USER, 'id_to_uid'):
                result.user_id = api.USER.id_to_uid(result.user_id)
            if hasattr(api.TENANT, 'id_to_uid'):
                result.tenant_id = api.TENANT.id_to_uid(result.tenant_id)

        return results