Пример #1
0
def init_app(app):

    endpoint_name = 'ingest'
    service = AppIngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_versions'
    service = ArchiveVersionsService(endpoint_name, backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive'
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_lock'
    service = ArchiveLockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unlock'
    service = ArchiveUnlockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_spike'
    service = ArchiveSpikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unspike'
    service = ArchiveUnspikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnspikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'user_content'
    service = UserContentService(endpoint_name, backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_rewrite'
    service = ArchiveRewriteService(endpoint_name, backend=superdesk.get_backend())
    ArchiveRewriteResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_autosave'
    service = ArchiveSaveService(endpoint_name, backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel
    register_component(ItemLock(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(name='archive', label='Archive', description='User can view the published content.')
    superdesk.privilege(name='ingest', label='Ingest', description='User can view content in ingest and fetch it.')
    superdesk.privilege(name='spike', label='Spike', description='User can spike content.')
    superdesk.privilege(name='unspike', label='Un Spike', description='User can un-spike content.')
    superdesk.privilege(name='unlock', label='Unlock content', description='User can unlock content.')
    superdesk.privilege(name='metadata_uniquename', label='Edit Unique Name', description='User can edit unique name.')
    superdesk.privilege(name='hold', label='Hold', description='Hold a content')
    superdesk.privilege(name='restore', label='Restore', description='Restore a hold a content')
    superdesk.privilege(name='rewrite', label='Update', description='Update a published content')

    superdesk.intrinsic_privilege(ArchiveUnlockResource.endpoint_name, method=['POST'])
Пример #2
0
def init_app(app):
    IngestModel(app=app)
    ArchiveVersionsModel(app=app)
    ArchiveModel(app=app)
    ArchiveMediaModel(app=app)
    ArchiveIngestModel(app=app)
    ItemCommentsModel(app=app)
    ItemCommentsSubModel(app=app)
    ArchiveLockModel(app)
    ArchiveUnlockModel(app)
    UserContentModel(app)
    ContentViewModel(app=app)
    ContentViewItemsModel(app=app)
    ArchiveAutosaveModel(app)
    register_component(ItemLock(app))
    register_model(ItemModel(EveProxy(app.data)))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(app.data)))
Пример #3
0
def init_app(app):
    datalayer = LegalArchiveDataLayer(app)

    register_model(LegalArchiveModel(EveProxy(datalayer)))
    register_component(LegalArchive(app))
    register_component(LegalArchiveProxy(app))

    endpoint_name = 'legal_archive'
    service = LegalArchiveService(endpoint_name, backend=datalayer)
    LegalArchiveResource(endpoint_name, app=app, service=service)

    register_model(ErrorsModel(EveProxy(datalayer)))
    register_component(Error(app))

    endpoint_name = 'errors'
    service = BaseService(endpoint_name, backend=datalayer)
    ErrorsResource(endpoint_name, app=app, service=service)
Пример #4
0
def init_app(app):
    """Initialize planning plugin.

    :param app: superdesk app
    """
    agendas_service = AgendasService('agenda', backend=superdesk.get_backend())
    AgendasResource('agenda', app=app, service=agendas_service)

    locations_search_service = LocationsService('locations', backend=superdesk.get_backend())
    LocationsResource('locations', app=app, service=locations_search_service)

    register_component(LockService(app))

    init_events_app(app)
    init_planning_app(app)
    init_assignments_app(app)
    init_search_app(app)
    init_validator_app(app)

    endpoint_name = 'published_planning'
    planning_published_service = PublishedPlanningService(endpoint_name, backend=superdesk.get_backend())
    PublishedPlanningResource(endpoint_name, app=app, service=planning_published_service)

    superdesk.privilege(
        name='planning',
        label='Planning',
        description='Create, update, and delete  events, planning items, and coverages'
    )

    superdesk.privilege(
        name='planning_agenda_management',
        label='Planning - Agenda Management',
        description='Ability to create and modify Agendas'
    )

    superdesk.privilege(
        name='planning_agenda_delete',
        label='Planning - Delete Agendas',
        description='Ability to delete an Agenda'
    )

    superdesk.privilege(
        name='planning_edit_expired',
        label='Planning - Edit Expired Items',
        description='Ability to edit expired Event and Planning items'
    )

    superdesk.privilege(
        name='planning_create_past',
        label='Planning - Create Event/Planning in the past',
        description='Ability to create an Event or Planning item in the past'
    )

    app.on_update_users += PlanningNotifications().user_update

    superdesk.register_default_user_preference('slack:notification', {
        'type': 'bool',
        'enabled': True,
        'default': False,
        'label': 'Allow Notifications To Slack',
        'category': 'notifications'
    })

    superdesk.register_default_user_preference('planning:calendar', {
        'type': 'dict',
        'label': 'Default Calendar',
        'category': 'planning',
        'calendar': {}
    })

    superdesk.register_default_user_preference('planning:agenda', {
        'type': 'dict',
        'label': 'Default Agenda',
        'category': 'planning',
        'agenda': {},
        'default': None
    })

    app.client_config['max_recurrent_events'] = get_max_recurrent_events(app)
    app.client_config['street_map_url'] = get_street_map_url(app)
    app.client_config['max_multi_day_event_duration'] = get_event_max_multi_day_duration(app)
Пример #5
0
def init_app(app):
    """Initialize planning plugin.

    :param app: superdesk app
    """
    agendas_service = AgendasService('agenda', backend=superdesk.get_backend())
    AgendasResource('agenda', app=app, service=agendas_service)

    locations_search_service = LocationsService(
        'locations', backend=superdesk.get_backend())
    LocationsResource('locations', app=app, service=locations_search_service)

    register_component(LockService(app))

    init_events_app(app)
    init_planning_app(app)
    init_assignments_app(app)
    init_search_app(app)
    init_validator_app(app)

    endpoint_name = 'published_planning'
    planning_published_service = PublishedPlanningService(
        endpoint_name, backend=superdesk.get_backend())
    PublishedPlanningResource(endpoint_name,
                              app=app,
                              service=planning_published_service)

    superdesk.privilege(
        name='planning',
        label='Planning',
        description=
        'Create, update, and delete  events, planning items, and coverages')

    superdesk.privilege(name='planning_agenda_management',
                        label='Planning - Agenda Management',
                        description='Ability to create and modify Agendas')

    superdesk.privilege(name='planning_agenda_delete',
                        label='Planning - Delete Agendas',
                        description='Ability to delete an Agenda')

    superdesk.privilege(
        name='planning_edit_expired',
        label='Planning - Edit Expired Items',
        description='Ability to edit expired Event and Planning items')

    superdesk.privilege(
        name='planning_create_past',
        label='Planning - Create Event/Planning in the past',
        description='Ability to create an Event or Planning item in the past')

    app.on_update_users += PlanningNotifications().user_update

    superdesk.register_default_user_preference(
        'slack:notification', {
            'type': 'bool',
            'enabled': True,
            'default': False,
            'label': 'Allow Notifications To Slack',
            'category': 'notifications'
        })

    superdesk.register_default_user_preference(
        'planning:calendar', {
            'type': 'dict',
            'label': 'Default Calendar',
            'category': 'planning',
            'calendar': {}
        })

    superdesk.register_default_user_preference(
        'planning:agenda', {
            'type': 'dict',
            'label': 'Default Agenda',
            'category': 'planning',
            'agenda': {},
            'default': None
        })

    superdesk.register_default_user_preference(
        'planning:default_coverage_desks', {
            'type': 'dict',
            'label': 'Default desk for coverage types',
            'category': 'planning',
            'desks': {},
            'default': None
        })

    app.client_config['max_recurrent_events'] = get_max_recurrent_events(app)
    app.client_config['street_map_url'] = get_street_map_url(app)
    app.client_config[
        'max_multi_day_event_duration'] = get_event_max_multi_day_duration(app)

    # Set up Celery task options
    if not app.config.get('CELERY_TASK_ROUTES'):
        app.config['CELERY_TASK_ROUTES'] = CTR

    if not app.config.get('CELERY_TASK_ROUTES').get('planning.flag_expired'):
        app.config['CELERY_TASK_ROUTES']['planning.flag_expired'] = {
            'queue': celery_queue('expiry'),
            'routing_key': 'expiry.planning'
        }

    if not app.config.get('CELERY_TASK_ROUTES').get('planning.delete_spiked'):
        app.config['CELERY_TASK_ROUTES']['planning.delete_spiked'] = {
            'queue': celery_queue('expiry'),
            'routing_key': 'expiry.delete'
        }

    if not app.config.get('CELERY_BEAT_SCHEDULE'):
        app.config['CELERY_BEAT_SCHEDULE'] = CBS

    if app.config.get('PLANNING_EXPIRY_MINUTES', 0) != 0 and \
            not app.config.get('CELERY_BEAT_SCHEDULE').get('planning:expiry'):
        app.config['CELERY_BEAT_SCHEDULE']['planning:expiry'] = {
            'task': 'planning.flag_expired',
            'schedule': crontab(minute='0')  # Runs once every hour
        }

    if app.config.get('PLANNING_DELETE_SPIKED_MINUTES', 0) != 0 and \
            not app.config.get('CELERY_BEAT_SCHEDULE').get('planning:delete'):
        app.config['CELERY_BEAT_SCHEDULE']['planning:delete'] = {
            'task': 'planning.delete_spiked',
            'schedule': crontab(minute='0')  # Runs once every hour
        }

    # Create 'type' required for planning module if not already preset
    with app.app_context():
        vocabulary_service = superdesk.get_resource_service('vocabularies')
        types = vocabulary_service.find_one(req=None, _id='type')
        if types:
            items = types.get('items') or []
            added_types = []
            type_names = [t['qcode'] for t in items]

            planning_type_list = [{
                "is_active": True,
                "name": "Planning item",
                "qcode": "planning"
            }, {
                "is_active": True,
                "name": "Event",
                "qcode": "event"
            }, {
                "is_active": True,
                "name": "Featured Stories",
                "qcode": "planning_featured"
            }]

            for item in planning_type_list:
                if item['qcode'] not in type_names:
                    added_types.append(item)

            if len(added_types) > 0:
                vocabulary_service.patch(types.get(config.ID_FIELD),
                                         {"items": (items + added_types)})
Пример #6
0
def init_app(app):
    """Initialize planning plugin.

    :param app: superdesk app
    """
    agendas_service = AgendasService('agenda', backend=superdesk.get_backend())
    AgendasResource('agenda', app=app, service=agendas_service)

    locations_search_service = LocationsService('locations', backend=superdesk.get_backend())
    LocationsResource('locations', app=app, service=locations_search_service)

    export_template_service = PlanningExportTemplatesService(PlanningExportTemplatesResource.endpoint_name,
                                                             backend=superdesk.get_backend())
    PlanningExportTemplatesResource(PlanningExportTemplatesResource.endpoint_name,
                                    app=app,
                                    service=export_template_service)

    register_component(LockService(app))

    init_events_app(app)
    init_planning_app(app)
    init_assignments_app(app)
    init_search_app(app)
    init_validator_app(app)
    init_planning_download_app(app)

    superdesk.register_resource(
        'planning_article_export',
        PlanningArticleExportResource,
        PlanningArticleExportService,
        privilege='planning',
        _app=app
    )

    endpoint_name = 'published_planning'
    planning_published_service = PublishedPlanningService(endpoint_name, backend=superdesk.get_backend())
    PublishedPlanningResource(endpoint_name, app=app, service=planning_published_service)

    superdesk.privilege(
        name='planning',
        label='Planning',
        description='Create, update, and delete  events, planning items, and coverages'
    )

    superdesk.privilege(
        name='planning_agenda_management',
        label='Planning - Agenda Management',
        description='Ability to create and modify Agendas'
    )

    superdesk.privilege(
        name='planning_agenda_delete',
        label='Planning - Delete Agendas',
        description='Ability to delete an Agenda'
    )

    superdesk.privilege(
        name='planning_edit_expired',
        label='Planning - Edit Expired Items',
        description='Ability to edit expired Event and Planning items'
    )

    superdesk.privilege(
        name='planning_create_past',
        label='Planning - Create Event/Planning in the past',
        description='Ability to create an Event or Planning item in the past'
    )

    superdesk.privilege(
        name='planning_locations_management',
        label='Planning - Manage locations',
        decsription='Ability to create, edit and delete locations'
    )

    superdesk.privilege(
        name='planning_assignments_view',
        label='Planning - Assignments view',
        decsription='Ability to access assignments view'
    )

    app.on_update_users += PlanningNotifications().user_update

    superdesk.register_default_user_preference('slack:notification', {
        'type': 'bool',
        'enabled': True,
        'default': False,
        'label': 'Allow Notifications To Slack',
        'category': 'notifications'
    })

    superdesk.register_default_user_preference('planning:calendar', {
        'type': 'dict',
        'label': 'Default Calendar',
        'category': 'planning',
        'calendar': {}
    })

    superdesk.register_default_user_preference('planning:agenda', {
        'type': 'dict',
        'label': 'Default Agenda',
        'category': 'planning',
        'agenda': {},
        'default': None
    })

    superdesk.register_default_user_preference('planning:events_planning_filter', {
        'type': 'dict',
        'label': 'Default Events Planning Filter',
        'category': 'planning',
        'filter': {},
        'default': None
    })

    superdesk.register_default_user_preference('planning:default_coverage_desks', {
        'type': 'dict',
        'label': 'Default desk for coverage types',
        'category': 'planning',
        'desks': {},
        'default': None
    })

    superdesk.register_default_user_preference('planning:add_coverage_advanced_mode', {
        'type': 'bool',
        'enabled': False,
        'default': False,
        'label': 'Open advanced mode when adding coverages',
        'category': 'planning',
    })

    app.client_config['max_recurrent_events'] = get_max_recurrent_events(app)
    app.client_config['street_map_url'] = get_street_map_url(app)
    app.client_config['max_multi_day_event_duration'] = get_event_max_multi_day_duration(app)
    app.client_config['planning_auto_assign_to_workflow'] = planning_auto_assign_to_workflow(app)
    app.client_config['long_event_duration_threshold'] = get_long_event_duration_threshold(app)
    app.client_config['event_templates_enabled'] = event_templates_enabled(app)
    app.client_config['planning_allow_scheduled_updates'] = get_planning_allow_scheduled_updates(app)
    app.client_config['planning_link_updates_to_coverage'] = planning_link_updates_to_coverage(app)
    app.client_config['planning_use_xmp_for_pic_assignments'] = get_planning_use_xmp_for_pic_assignments(app)
    app.client_config['planning_use_xmp_for_pic_slugline'] = get_planning_use_xmp_for_pic_slugline(app)

    # Set up Celery task options
    if not app.config.get('CELERY_TASK_ROUTES'):
        app.config['CELERY_TASK_ROUTES'] = CTR

    if not app.config.get('CELERY_TASK_ROUTES').get('planning.flag_expired'):
        app.config['CELERY_TASK_ROUTES']['planning.flag_expired'] = {
            'queue': celery_queue('expiry'),
            'routing_key': 'expiry.planning'
        }

    if not app.config.get('CELERY_TASK_ROUTES').get('planning.delete_spiked'):
        app.config['CELERY_TASK_ROUTES']['planning.delete_spiked'] = {
            'queue': celery_queue('expiry'),
            'routing_key': 'expiry.delete'
        }

    if not app.config.get('CELERY_TASK_ROUTES').get('planning.delete_assignments'):
        app.config['CELERY_TASK_ROUTES']['planning.delete_assignments'] = {
            'queue': celery_queue('expiry'),
            'routing_key': 'expiry.delete_assignments'
        }

    if not app.config.get('CELERY_BEAT_SCHEDULE'):
        app.config['CELERY_BEAT_SCHEDULE'] = CBS

    if app.config.get('PLANNING_EXPIRY_MINUTES', 0) != 0 and \
            not app.config.get('CELERY_BEAT_SCHEDULE').get('planning:expiry'):
        app.config['CELERY_BEAT_SCHEDULE']['planning:expiry'] = {
            'task': 'planning.flag_expired',
            'schedule': crontab(minute='0')  # Runs once every hour
        }

    if app.config.get('PLANNING_DELETE_SPIKED_MINUTES', 0) != 0 and \
            not app.config.get('CELERY_BEAT_SCHEDULE').get('planning:delete'):
        app.config['CELERY_BEAT_SCHEDULE']['planning:delete'] = {
            'task': 'planning.delete_spiked',
            'schedule': crontab(minute='0')  # Runs once every hour
        }

    if not app.config['CELERY_BEAT_SCHEDULE'].get('planning:delete_assignments'):
        app.config['CELERY_BEAT_SCHEDULE']['planning:delete_assignments'] = {
            'task': 'planning.delete_assignments',
            'schedule': timedelta(seconds=60)  # Runs once every minute
        }

    # Create 'type' required for planning module if not already preset
    with app.app_context():
        vocabulary_service = superdesk.get_resource_service('vocabularies')
        types = vocabulary_service.find_one(req=None, _id='type')
        if types:
            items = types.get('items') or []
            added_types = []
            type_names = [t['qcode'] for t in items]

            planning_type_list = [
                {"is_active": True, "name": "Planning item", "qcode": "planning"},
                {"is_active": True, "name": "Event", "qcode": "event"},
                {"is_active": True, "name": "Featured Stories", "qcode": "planning_featured"}
            ]

            for item in planning_type_list:
                if item['qcode'] not in type_names:
                    added_types.append(item)

            if len(added_types) > 0:
                vocabulary_service.patch(types.get(config.ID_FIELD), {
                    "items": (items + added_types)
                })

        custom_loaders = jinja2.ChoiceLoader(app.jinja_loader.loaders + [jinja2.FileSystemLoader(
            os.path.join(os.path.dirname(os.path.realpath(__file__)), 'templates'))])
        app.jinja_loader = custom_loaders

        register_jinja_filter('formatted_address', get_formatted_address)
Пример #7
0
def init_app(app):

    endpoint_name = "ingest"
    service = AppIngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_versions"
    service = ArchiveVersionsService(endpoint_name,
                                     backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive"
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_lock"
    service = ArchiveLockService(endpoint_name,
                                 backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_unlock"
    service = ArchiveUnlockService(endpoint_name,
                                   backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_spike"
    service = ArchiveSpikeService(endpoint_name,
                                  backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_unspike"
    service = ArchiveUnspikeService(endpoint_name,
                                    backend=superdesk.get_backend())
    ArchiveUnspikeResource(endpoint_name, app=app, service=service)

    endpoint_name = "user_content"
    service = UserContentService(endpoint_name,
                                 backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_rewrite"
    service = ArchiveRewriteService(endpoint_name,
                                    backend=superdesk.get_backend())
    ArchiveRewriteResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_correction"
    service = ArchiveCorrectionService(endpoint_name,
                                       backend=superdesk.get_backend())
    ArchiveCorrectionResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_autosave"
    service = ArchiveSaveService(endpoint_name,
                                 backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_related"
    service = ArchiveRelatedService(endpoint_name,
                                    backend=superdesk.get_backend())
    ArchiveRelatedResource(endpoint_name, app=app, service=service)

    endpoint_name = "news"
    service = NewsService(endpoint_name, backend=superdesk.get_backend())
    NewsResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel

    register_component(ItemLock(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(
        name="monitoring_view",
        label=_("Monitoring view"),
        description=_("Access to Monitoring view in left toolbar"))
    superdesk.privilege(name="archive",
                        label=_("Create content"),
                        description=_("Create and save content"))
    superdesk.privilege(name="ingest",
                        label=_("Ingest"),
                        description=_("Access to ingest sources management"))
    superdesk.privilege(name="spike",
                        label=_("Spike"),
                        description=_("Spike/delete items"))
    superdesk.privilege(name="spike_read",
                        label=_("Spike view"),
                        description=_("View spiked content"))
    superdesk.privilege(name="unspike",
                        label=_("Unspike"),
                        description=_("Unspike/undelete content"))
    superdesk.privilege(name="metadata_uniquename",
                        label=_("Edit Unique Name"),
                        description=_("Edit unique name"))
    superdesk.privilege(name="hold",
                        label=_("Hold"),
                        description=_("Hold content"))
    superdesk.privilege(name="restore",
                        label=_("Restore"),
                        description=_("Restore content"))
    superdesk.privilege(name="rewrite",
                        label=_("Update"),
                        description=_("Create an update"))
    superdesk.privilege(name="unlock",
                        label=_("Unlock content"),
                        description=_("Unlock locked content by another user"))
    superdesk.privilege(
        name="mark_for_user",
        label=_("Mark items for users"),
        description=_("User can mark or unmark items for other users"),
    )

    superdesk.intrinsic_privilege(ArchiveUnlockResource.endpoint_name,
                                  method=["POST"])
Пример #8
0
def init_app(app):

    endpoint_name = 'ingest'
    service = AppIngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_versions'
    service = superdesk.Service(endpoint_name, backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive'
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'item_comments'
    service = ItemCommentsService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_item_comments'
    service = ItemCommentsSubService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsSubResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_lock'
    service = ArchiveLockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unlock'
    service = ArchiveUnlockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_spike'
    service = ArchiveSpikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unspike'
    service = ArchiveUnspikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnspikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'user_content'
    service = UserContentService(endpoint_name, backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_link'
    service = ArchiveLinkService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLinkResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_rewrite'
    service = ArchiveRewriteService(endpoint_name, backend=superdesk.get_backend())
    ArchiveRewriteResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_autosave'
    service = ArchiveSaveService(endpoint_name, backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel
    register_component(ItemLock(app))
    register_component(ItemHold(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(name='archive', label='Archive', description='User can view the published content.')
    superdesk.privilege(name='ingest', label='Ingest', description='User can view content in ingest and fetch it.')
    superdesk.privilege(name='spike', label='Spike', description='User can spike content.')
    superdesk.privilege(name='unspike', label='Un Spike', description='User can un-spike content.')
    superdesk.privilege(name='unlock', label='Unlock content', description='User can unlock content.')
    superdesk.privilege(name='metadata_uniquename', label='Edit Unique Name', description='User can edit unique name.')
    superdesk.privilege(name='hold', label='Hold', description='Hold a content')
    superdesk.privilege(name='restore', label='Restore', description='Restore a hold a content')
    superdesk.privilege(name='rewrite', label='Rewrite', description='Rewrite a published content')

    superdesk.intrinsic_privilege(ArchiveUnlockResource.endpoint_name, method=['POST'])
    superdesk.intrinsic_privilege(ArchiveLinkResource.endpoint_name, method=['POST'])
Пример #9
0
def init_app(app):

    endpoint_name = 'ingest'
    service = IngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_versions'
    service = superdesk.Service(endpoint_name, backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive'
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'item_comments'
    service = ItemCommentsService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_item_comments'
    service = ItemCommentsSubService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsSubResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_lock'
    service = ArchiveLockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unlock'
    service = ArchiveUnlockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_spike'
    service = ArchiveSpikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unspike'
    service = ArchiveUnspikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnspikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'user_content'
    service = UserContentService(endpoint_name, backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_link'
    service = ArchiveLinkService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLinkResource(endpoint_name, app=app, service=service)

    endpoint_name = 'saved_searches'
    service = SavedSearchesService(endpoint_name, backend=superdesk.get_backend())
    SavedSearchesResource(endpoint_name, app=app, service=service)

    endpoint_name = 'saved_search_items'
    service = SavedSearchItemsService(endpoint_name, backend=superdesk.get_backend())
    SavedSearchItemsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_autosave'
    service = ArchiveSaveService(endpoint_name, backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel
    register_component(ItemLock(app))
    register_component(ItemHold(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(name='archive', label='Archive', description='User can view the published content.')
    superdesk.privilege(name='ingest', label='Ingest', description='User can view content in ingest and fetch it.')
    superdesk.privilege(name='spike', label='Spike', description='User can spike content.')
    superdesk.privilege(name='unspike', label='Un Spike', description='User can un-spike content.')
    superdesk.privilege(name='unlock', label='Unlock content', description='User can unlock content.')
    superdesk.privilege(name='metadata_uniquename', label='Edit Unique Name', description='User can edit unique name.')
    superdesk.privilege(name='saved_searches', label='Manage Saved Searches',
                        description='User can manage Saved Searches')

    superdesk.privilege(name='kill', label='Kill', description='Kill a published content')
    superdesk.privilege(name='correct', label='Correction', description='Correction to a published content')
    superdesk.privilege(name='hold', label='Hold', description='Hold a content')
    superdesk.privilege(name='restore', label='Restore', description='Restore a hold a content')

    superdesk.intrinsic_privilege(ArchiveUnlockResource.endpoint_name, method=['POST'])
    superdesk.intrinsic_privilege(ArchiveLinkResource.endpoint_name, method=['POST'])
Пример #10
0
def init_app(app):

    endpoint_name = 'ingest'
    service = IngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_versions'
    service = ArchiveVersionsService(endpoint_name,
                                     backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive'
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_media'
    service = ArchiveMediaService(endpoint_name,
                                  backend=superdesk.get_backend())
    ArchiveMediaResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_media_versions'
    service = ArchiveVersionsService(endpoint_name,
                                     backend=superdesk.get_backend())
    ArchiveMediaVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_ingest'
    service = ArchiveIngestService(endpoint_name,
                                   backend=superdesk.get_backend())
    ArchiveIngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'item_comments'
    service = ItemCommentsService(endpoint_name,
                                  backend=superdesk.get_backend())
    ItemCommentsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_item_comments'
    service = ItemCommentsSubService(endpoint_name,
                                     backend=superdesk.get_backend())
    ItemCommentsSubResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_lock'
    service = ArchiveLockService(endpoint_name,
                                 backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unlock'
    service = ArchiveUnlockService(endpoint_name,
                                   backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_spike'
    service = ArchiveSpikeService(endpoint_name,
                                  backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'user_content'
    service = UserContentService(endpoint_name,
                                 backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_view'
    service = ContentViewService(endpoint_name,
                                 backend=superdesk.get_backend())
    ContentViewResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_view_items'
    service = ContentViewItemsService(endpoint_name,
                                      backend=superdesk.get_backend())
    ContentViewItemsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_autosave'
    service = ArchiveSaveService(endpoint_name,
                                 backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel
    register_component(ItemLock(app))
    register_component(ItemSpike(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))
Пример #11
0
def init_app(app):

    endpoint_name = 'ingest'
    service = IngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_versions'
    service = ArchiveVersionsService(endpoint_name,
                                     backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive'
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_media'
    service = ArchiveMediaService(endpoint_name,
                                  backend=superdesk.get_backend())
    ArchiveMediaResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_media_versions'
    service = ArchiveVersionsService(endpoint_name,
                                     backend=superdesk.get_backend())
    ArchiveMediaVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_ingest'
    service = ArchiveIngestService(endpoint_name,
                                   backend=superdesk.get_backend())
    ArchiveIngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'item_comments'
    service = ItemCommentsService(endpoint_name,
                                  backend=superdesk.get_backend())
    ItemCommentsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_item_comments'
    service = ItemCommentsSubService(endpoint_name,
                                     backend=superdesk.get_backend())
    ItemCommentsSubResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_lock'
    service = ArchiveLockService(endpoint_name,
                                 backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unlock'
    service = ArchiveUnlockService(endpoint_name,
                                   backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_spike'
    service = ArchiveSpikeService(endpoint_name,
                                  backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unspike'
    service = ArchiveUnspikeService(endpoint_name,
                                    backend=superdesk.get_backend())
    ArchiveUnspikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'user_content'
    service = UserContentService(endpoint_name,
                                 backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = 'saved_searches'
    service = SavedSearchesService(endpoint_name,
                                   backend=superdesk.get_backend())
    SavedSearchesResource(endpoint_name, app=app, service=service)

    endpoint_name = 'saved_search_items'
    service = SavedSearchItemsService(endpoint_name,
                                      backend=superdesk.get_backend())
    SavedSearchItemsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_autosave'
    service = ArchiveSaveService(endpoint_name,
                                 backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel
    register_component(ItemLock(app))
    register_component(ItemHold(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(name='archive',
                        label='Archive',
                        description='User can view the published content.')
    superdesk.privilege(
        name='ingest',
        label='Ingest',
        description='User can view content in ingest and fetch it.')
    superdesk.privilege(name='spike',
                        label='Spike',
                        description='User can spike content.')
    superdesk.privilege(name='unspike',
                        label='Un Spike',
                        description='User can un-spike content.')
    superdesk.privilege(name='unlock',
                        label='Unlock content',
                        description='User can unlock content.')
    superdesk.privilege(name='metadata_uniquename',
                        label='Edit Unique Name',
                        description='User can edit unique name.')
    superdesk.privilege(name='ingest_move',
                        label='Move Content To Desk',
                        description='Move Content to a Desk.')
    superdesk.privilege(name='saved_searches',
                        label='Manage Saved Searches',
                        description='User can manage Saved Searches')

    superdesk.privilege(name='publish',
                        label='Publish',
                        description='Publish a content')
    superdesk.privilege(name='kill',
                        label='Kill',
                        description='Kill a published content')
    superdesk.privilege(name='correction',
                        label='Correction',
                        description='Correction to a published content')
    superdesk.privilege(name='hold',
                        label='Hold',
                        description='Hold a content')
    superdesk.privilege(name='restore',
                        label='Restore',
                        description='Restore a hold a content')

    superdesk.intrinsic_privilege(ArchiveUnlockResource.endpoint_name,
                                  method=['POST'])
Пример #12
0
def init_app(app):

    endpoint_name = 'ingest'
    service = AppIngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_versions'
    service = ArchiveVersionsService(endpoint_name, backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive'
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_lock'
    service = ArchiveLockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unlock'
    service = ArchiveUnlockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_spike'
    service = ArchiveSpikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unspike'
    service = ArchiveUnspikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnspikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'user_content'
    service = UserContentService(endpoint_name, backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_rewrite'
    service = ArchiveRewriteService(endpoint_name, backend=superdesk.get_backend())
    ArchiveRewriteResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_autosave'
    service = ArchiveSaveService(endpoint_name, backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_related'
    service = ArchiveRelatedService(endpoint_name, backend=superdesk.get_backend())
    ArchiveRelatedResource(endpoint_name, app=app, service=service)

    endpoint_name = 'news'
    service = NewsService(endpoint_name, backend=superdesk.get_backend())
    NewsResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel
    register_component(ItemLock(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(
        name='monitoring_view',
        label=_('Monitoring view'),
        description=_('Access to Monitoring view in left toolbar')
    )
    superdesk.privilege(name='archive', label=_('Create content'), description=_('Create and save content'))
    superdesk.privilege(name='ingest', label=_('Ingest'), description=_('Access to ingest sources management'))
    superdesk.privilege(name='spike', label=_('Spike'), description=_('Spike/delete items'))
    superdesk.privilege(name='spike_read', label=_('Spike view'), description=_('View spiked content'))
    superdesk.privilege(name='unspike', label=_('Unspike'), description=_('Unspike/undelete content'))
    superdesk.privilege(name='metadata_uniquename', label=_('Edit Unique Name'), description=_('Edit unique name'))
    superdesk.privilege(name='hold', label=_('Hold'), description=_('Hold content'))
    superdesk.privilege(name='restore', label=_('Restore'), description=_('Restore content'))
    superdesk.privilege(name='rewrite', label=_('Update'), description=_('Create an update'))
    superdesk.privilege(name='unlock',
                        label=_('Unlock content'),
                        description=_('Unlock locked content by another user'))
    superdesk.privilege(name='mark_for_user',
                        label=_('Mark items for users'),
                        description=_('User can mark or unmark items for other users'))

    superdesk.intrinsic_privilege(ArchiveUnlockResource.endpoint_name, method=['POST'])
Пример #13
0
def init_app(app):

    endpoint_name = 'ingest'
    service = IngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_versions'
    service = ArchiveVersionsService(endpoint_name,
                                     backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive'
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_media'
    service = ArchiveMediaService(endpoint_name,
                                  backend=superdesk.get_backend())
    ArchiveMediaResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_media_versions'
    service = ArchiveVersionsService(endpoint_name,
                                     backend=superdesk.get_backend())
    ArchiveMediaVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_ingest'
    service = ArchiveIngestService(endpoint_name,
                                   backend=superdesk.get_backend())
    ArchiveIngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'item_comments'
    service = ItemCommentsService(endpoint_name,
                                  backend=superdesk.get_backend())
    ItemCommentsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_item_comments'
    service = ItemCommentsSubService(endpoint_name,
                                     backend=superdesk.get_backend())
    ItemCommentsSubResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_lock'
    service = ArchiveLockService(endpoint_name,
                                 backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unlock'
    service = ArchiveUnlockService(endpoint_name,
                                   backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_spike'
    service = ArchiveSpikeService(endpoint_name,
                                  backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'user_content'
    service = UserContentService(endpoint_name,
                                 backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_view'
    service = ContentViewService(endpoint_name,
                                 backend=superdesk.get_backend())
    ContentViewResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_view_items'
    service = ContentViewItemsService(endpoint_name,
                                      backend=superdesk.get_backend())
    ContentViewItemsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_autosave'
    service = ArchiveSaveService(endpoint_name,
                                 backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel
    register_component(ItemLock(app))
    register_component(ItemSpike(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(name='archive',
                        label='Archive',
                        description='User can view the published content.')
    superdesk.privilege(
        name='ingest',
        label='Ingest',
        description='User can view content in ingest and fetch it.')
    superdesk.privilege(name='spike',
                        label='Spike',
                        description='User can spike content.')
    superdesk.privilege(name='unspike',
                        label='Un Spike',
                        description='User can un-spike content.')
    superdesk.privilege(name='unlock',
                        label='Unlock content',
                        description='User can unlock content.')
    superdesk.privilege(name='metadata_uniquename',
                        label='Edit Unique Name',
                        description='User can edit unique name.')
    superdesk.privilege(name='ingest_move',
                        label='Move Content To Desk',
                        description='Move Content to a Desk.')
Пример #14
0
def init_app(app):

    endpoint_name = 'ingest'
    service = IngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_versions'
    service = ArchiveVersionsService(endpoint_name, backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive'
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_media'
    service = ArchiveMediaService(endpoint_name, backend=superdesk.get_backend())
    ArchiveMediaResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_media_versions'
    service = ArchiveVersionsService(endpoint_name, backend=superdesk.get_backend())
    ArchiveMediaVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_ingest'
    service = ArchiveIngestService(endpoint_name, backend=superdesk.get_backend())
    ArchiveIngestResource(endpoint_name, app=app, service=service)

    endpoint_name = 'item_comments'
    service = ItemCommentsService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_item_comments'
    service = ItemCommentsSubService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsSubResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_lock'
    service = ArchiveLockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_unlock'
    service = ArchiveUnlockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_spike'
    service = ArchiveSpikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = 'user_content'
    service = UserContentService(endpoint_name, backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_view'
    service = ContentViewService(endpoint_name, backend=superdesk.get_backend())
    ContentViewResource(endpoint_name, app=app, service=service)

    endpoint_name = 'content_view_items'
    service = ContentViewItemsService(endpoint_name, backend=superdesk.get_backend())
    ContentViewItemsResource(endpoint_name, app=app, service=service)

    endpoint_name = 'archive_autosave'
    service = ArchiveSaveService(endpoint_name, backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel
    register_component(ItemLock(app))
    register_component(ItemSpike(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(name='archive', label='Archive', description='User can view the published content.')
    superdesk.privilege(name='ingest', label='Ingest', description='User can view content in ingest and fetch it.')
    superdesk.privilege(name='spike', label='Spike', description='User can spike content.')
    superdesk.privilege(name='unspike', label='Un Spike', description='User can un-spike content.')
    superdesk.privilege(name='unlock', label='Unlock content', description='User can unlock content.')
    superdesk.privilege(name='metadata_uniquename', label='Edit Unique Name', description='User can edit unique name.')
    superdesk.privilege(name='ingest_move', label='Move Content To Desk', description='Move Content to a Desk.')
Пример #15
0
def init_app(app):

    endpoint_name = "ingest"
    service = IngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_versions"
    service = ArchiveVersionsService(endpoint_name, backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive"
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_media"
    service = ArchiveMediaService(endpoint_name, backend=superdesk.get_backend())
    ArchiveMediaResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_media_versions"
    service = ArchiveVersionsService(endpoint_name, backend=superdesk.get_backend())
    ArchiveMediaVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_ingest"
    service = ArchiveIngestService(endpoint_name, backend=superdesk.get_backend())
    ArchiveIngestResource(endpoint_name, app=app, service=service)

    endpoint_name = "item_comments"
    service = ItemCommentsService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsResource(endpoint_name, app=app, service=service)

    endpoint_name = "content_item_comments"
    service = ItemCommentsSubService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsSubResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_lock"
    service = ArchiveLockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_unlock"
    service = ArchiveUnlockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_spike"
    service = ArchiveSpikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_unspike"
    service = ArchiveUnspikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnspikeResource(endpoint_name, app=app, service=service)

    endpoint_name = "user_content"
    service = UserContentService(endpoint_name, backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = "saved_searches"
    service = SavedSearchesService(endpoint_name, backend=superdesk.get_backend())
    SavedSearchesResource(endpoint_name, app=app, service=service)

    endpoint_name = "saved_search_items"
    service = SavedSearchItemsService(endpoint_name, backend=superdesk.get_backend())
    SavedSearchItemsResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_autosave"
    service = ArchiveSaveService(endpoint_name, backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel

    register_component(ItemLock(app))
    register_component(ItemHold(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(name="archive", label="Archive", description="User can view the published content.")
    superdesk.privilege(name="ingest", label="Ingest", description="User can view content in ingest and fetch it.")
    superdesk.privilege(name="spike", label="Spike", description="User can spike content.")
    superdesk.privilege(name="unspike", label="Un Spike", description="User can un-spike content.")
    superdesk.privilege(name="unlock", label="Unlock content", description="User can unlock content.")
    superdesk.privilege(name="metadata_uniquename", label="Edit Unique Name", description="User can edit unique name.")
    superdesk.privilege(name="ingest_move", label="Move Content To Desk", description="Move Content to a Desk.")
    superdesk.privilege(
        name="saved_searches", label="Manage Saved Searches", description="User can manage Saved Searches"
    )

    superdesk.privilege(name="publish", label="Publish", description="Publish a content")
    superdesk.privilege(name="kill", label="Kill", description="Kill a published content")
    superdesk.privilege(name="correction", label="Correction", description="Correction to a published content")
    superdesk.privilege(name="hold", label="Hold", description="Hold a content")
    superdesk.privilege(name="restore", label="Restore", description="Restore a hold a content")

    superdesk.intrinsic_privilege(ArchiveUnlockResource.endpoint_name, method=["POST"])
Пример #16
0
def init_app(app):

    endpoint_name = "ingest"
    service = AppIngestService(endpoint_name, backend=superdesk.get_backend())
    IngestResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_versions"
    service = superdesk.Service(endpoint_name, backend=superdesk.get_backend())
    ArchiveVersionsResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive"
    service = ArchiveService(endpoint_name, backend=superdesk.get_backend())
    ArchiveResource(endpoint_name, app=app, service=service)

    endpoint_name = "item_comments"
    service = ItemCommentsService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsResource(endpoint_name, app=app, service=service)

    endpoint_name = "content_item_comments"
    service = ItemCommentsSubService(endpoint_name, backend=superdesk.get_backend())
    ItemCommentsSubResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_lock"
    service = ArchiveLockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLockResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_unlock"
    service = ArchiveUnlockService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnlockResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_spike"
    service = ArchiveSpikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveSpikeResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_unspike"
    service = ArchiveUnspikeService(endpoint_name, backend=superdesk.get_backend())
    ArchiveUnspikeResource(endpoint_name, app=app, service=service)

    endpoint_name = "user_content"
    service = UserContentService(endpoint_name, backend=superdesk.get_backend())
    UserContentResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_link"
    service = ArchiveLinkService(endpoint_name, backend=superdesk.get_backend())
    ArchiveLinkResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_rewrite"
    service = ArchiveRewriteService(endpoint_name, backend=superdesk.get_backend())
    ArchiveRewriteResource(endpoint_name, app=app, service=service)

    endpoint_name = "archive_autosave"
    service = ArchiveSaveService(endpoint_name, backend=superdesk.get_backend())
    AutoSaveResource(endpoint_name, app=app, service=service)

    from apps.item_autosave.components.item_autosave import ItemAutosave
    from apps.item_autosave.models.item_autosave import ItemAutosaveModel

    register_component(ItemLock(app))
    register_component(ItemHold(app))
    register_model(ItemModel(EveProxy(superdesk.get_backend())))
    register_component(ItemAutosave(app))
    register_model(ItemAutosaveModel(EveProxy(superdesk.get_backend())))

    superdesk.privilege(name="archive", label="Archive", description="User can view the published content.")
    superdesk.privilege(name="ingest", label="Ingest", description="User can view content in ingest and fetch it.")
    superdesk.privilege(name="spike", label="Spike", description="User can spike content.")
    superdesk.privilege(name="unspike", label="Un Spike", description="User can un-spike content.")
    superdesk.privilege(name="unlock", label="Unlock content", description="User can unlock content.")
    superdesk.privilege(name="metadata_uniquename", label="Edit Unique Name", description="User can edit unique name.")
    superdesk.privilege(name="hold", label="Hold", description="Hold a content")
    superdesk.privilege(name="restore", label="Restore", description="Restore a hold a content")
    superdesk.privilege(name="rewrite", label="Update", description="Update a published content")

    superdesk.intrinsic_privilege(ArchiveUnlockResource.endpoint_name, method=["POST"])
    superdesk.intrinsic_privilege(ArchiveLinkResource.endpoint_name, method=["POST"])