예제 #1
0
 def get_user(self, admin_token, user_id):
     self.__validate_admin_token(admin_token)
     duser = api.USER.get(user_id)
     if not duser:
         raise fault.ItemNotFoundFault("The user could not be found")
     return User_Update(id=duser.id, tenant_id=duser.tenant_id,
             email=duser.email, enabled=duser.enabled, name=duser.name)
예제 #2
0
파일: service.py 프로젝트: dais/colony
    def enable_disable_user(self, admin_token, user_id, user):
        self.__validate_admin_token(admin_token)
        duser = api.USER.get(user_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be found")
        if not isinstance(user, User):
            raise fault.BadRequestFault("Expecting a User")

        values = {'enabled': user.enabled}

        api.USER.update(user_id, values)

        duser = api.USER.get(user_id)

        return User_Update(enabled=user.enabled)
예제 #3
0
    def set_user_tenant(self, admin_token, user_id, user):
        self.__validate_admin_token(admin_token)
        duser = api.USER.get(user_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be found")
        if not isinstance(user, User):
            raise fault.BadRequestFault("Expecting a User")

        duser = api.USER.get(user_id)
        if duser == None:
            raise fault.ItemNotFoundFault("The user could not be found")

        self.validate_and_fetch_user_tenant(user.tenant_id)
        values = {'tenant_id': user.tenant_id}
        api.USER.update(user_id, values)
        return User_Update(tenant_id=user.tenant_id)
예제 #4
0
파일: service.py 프로젝트: dais/colony
    def set_user_password(self, admin_token, user_id, user):
        self.__validate_admin_token(admin_token)

        duser = api.USER.get(user_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be found")

        if not isinstance(user, User):
            raise fault.BadRequestFault("Expecting a User")

        if not user.password:
            raise fault.BadRequestFault("Expecting a Password")

        values = {'password': user.password}

        api.USER.update(user_id, values)

        return User_Update(password=user.password)
예제 #5
0
파일: service.py 프로젝트: dais/colony
    def set_user_eppn(self, admin_token, user_id, user):
        self.__validate_admin_token(admin_token)

        duser = api.USER.get(user_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be found")

        if not isinstance(user, User):
            raise fault.BadRequestFault("Expecting a User")

        if not user.eppn:
            raise fault.BadRequestFault("Expecting a Eppn")

        if user.eppn != duser.eppn and \
                api.USER.get_by_eppn(user.eppn) is not None:
            raise fault.EppnConflictFault("Eppn already exists")

        values = {'eppn': user.eppn}
        api.USER.update(user_id, values)

        return User_Update(eppn=user.eppn)
예제 #6
0
    def set_user_password(self, admin_token, user_id, user):
        self.__validate_admin_token(admin_token)

        duser = api.USER.get(user_id)
        if not duser:
            raise fault.ItemNotFoundFault("The user could not be found")

        if not isinstance(user, User):
            raise fault.BadRequestFault("Expecting a User")

        if not user.password:
            raise fault.BadRequestFault("Expecting a Password")

        values = {'password': user.password}

        api.USER.update(user_id, values)

        dtenant = api.TENANT.get_user_tenants(user_id)
        secret = {'secret': user.password}
        api.CREDENTIALS.update_secret(dtenant[0].name + ":" + duser.name,
                                      secret)

        return User_Update(password=user.password)