Beispiel #1
0
class PacksController(BasePacksController):
    from st2api.controllers.v1.packviews import PackViewsController

    model = PackAPI
    access = Pack
    supported_filters = {'name': 'name', 'ref': 'ref'}

    query_options = {'sort': ['ref']}

    # Nested controllers
    install = PackInstallController()
    uninstall = PackUninstallController()
    register = PackRegisterController()
    views = PackViewsController()
    index = PacksIndexController()

    def __init__(self):
        super(PacksController, self).__init__()
        self.get_one_db_method = self._get_by_ref_or_id

    def get_all(self, **kwargs):
        return super(PacksController, self)._get_all(**kwargs)

    def get_one(self, ref_or_id, requester_user):
        return self._get_one_by_ref_or_id(ref_or_id=ref_or_id,
                                          requester_user=requester_user)
Beispiel #2
0
class PacksController(BasePacksController):
    from st2api.controllers.v1.packviews import PackViewsController

    model = PackAPI
    access = Pack
    supported_filters = {'name': 'name', 'ref': 'ref'}

    query_options = {'sort': ['ref']}

    # Nested controllers
    install = PackInstallController()
    uninstall = PackUninstallController()
    register = PackRegisterController()
    views = PackViewsController()
    index = PacksIndexController()

    @request_user_has_permission(permission_type=PermissionType.PACK_LIST)
    @jsexpose()
    def get_all(self, **kwargs):
        return super(PacksController, self)._get_all(**kwargs)

    @request_user_has_resource_db_permission(
        permission_type=PermissionType.PACK_VIEW)
    @jsexpose(arg_types=[str])
    def get_one(self, ref_or_id):
        return self._get_one_by_ref_or_id(ref_or_id=ref_or_id)
Beispiel #3
0
class PacksController(ResourceController):
    model = PackAPI
    access = Pack
    supported_filters = {'name': 'name', 'ref': 'ref'}

    query_options = {'sort': ['ref']}

    # Nested controllers
    views = PackViewsController()

    @jsexpose(arg_types=[str])
    def get_one(self, name_or_id):
        return self._get_one_by_name_or_id(name_or_id=name_or_id)