Ejemplo n.º 1
0
class LogoutResource(AccountViewMixin, GenericAPIResource):
    """ API View for logging in to the App"""
    request_object_cls = LogoutRequestObject
    usecase_cls = LogoutUseCase
    decorators = [is_authenticated()]

    def post(self):
        """Logout of the application
        """
        return self._process_request(self.usecase_cls,
                                     self.request_object_cls,
                                     payload={'account': context.account},
                                     no_serialization=True)
Ejemplo n.º 2
0
class ChangePasswordResource(AccountViewMixin, GenericAPIResource):
    """ API View for updating the account password """
    request_object_cls = ChangeAccountPasswordRequestObject
    usecase_cls = ChangeAccountPasswordUseCase
    decorators = [is_authenticated()]

    def post(self):
        """Change the password for the account
        """
        payload = {'identifier': context.account.id, 'data': request.payload}
        return self._process_request(self.usecase_cls,
                                     self.request_object_cls,
                                     payload=payload,
                                     no_serialization=True)
Ejemplo n.º 3
0
class SomeProtectedView(ShowAPIResource):
    """ A simple protected class based view """
    entity_cls = get_account_entity()
    serializer_cls = AccountSerializer
    decorators = [is_authenticated()]
Ejemplo n.º 4
0
class DeleteAccountResource(AccountViewMixin, DeleteAPIResource):
    """ API View for deleting an account """
    decorators = [is_authenticated()]
Ejemplo n.º 5
0
class ShowAccountResource(AccountViewMixin, ShowAPIResource):
    """ API View for showing an account """
    decorators = [is_authenticated()]
Ejemplo n.º 6
0
class ListAccountResource(AccountViewMixin, ListAPIResource):
    """ API View for list an accounts """
    decorators = [is_authenticated()]
Ejemplo n.º 7
0
class UpdateAccountResource(AccountViewMixin, UpdateAPIResource):
    """ API View for updating an account """
    request_object_cls = UpdateAccountRequestObject
    usecase_cls = UpdateAccountUseCase
    decorators = [is_authenticated()]