コード例 #1
0
def init_app(app):
    endpoint_name = 'auth'
    service = BaseService('auth', backend=superdesk.get_backend())
    AuthResource(endpoint_name, app=app, service=service)

    service = BaseService('auth_user', backend=superdesk.get_backend())
    AuthUsersResource('auth_user', app=app, service=service)
コード例 #2
0
ファイル: __init__.py プロジェクト: vladnicoara/superdesk
def init_app(app):
    app.auth = SuperdeskTokenAuth()  # Overwrite the app default auth

    endpoint_name = 'auth_users'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    AuthUsersResource(endpoint_name, app=app, service=service)

    endpoint_name = 'sessions'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    SessionsResource(endpoint_name, app=app, service=service)
コード例 #3
0
def init_app(app):
    endpoint_name = 'agenda_city_map'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    CityMapResource(endpoint_name, app=app, service=service)

    endpoint_name = 'agenda_iptc_map'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    IPTCMapResource(endpoint_name, app=app, service=service)

    endpoint_name = 'agenda_country_map'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    CountryMapResource(endpoint_name, app=app, service=service)
コード例 #4
0
def init_app(app):
    from .ingest_provider_model import IngestProviderResource
    from superdesk.services import BaseService
    import superdesk
    endpoint_name = 'ingest_providers'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    IngestProviderResource(endpoint_name, app=app, service=service)
コード例 #5
0
ファイル: groups.py プロジェクト: liveblog/superdesk-server
def init_app(app):
    endpoint_name = 'groups'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    GroupsResource(endpoint_name, app=app, service=service)
    endpoint_name = 'user_groups'
    service = UserGroupsService(endpoint_name, backend=superdesk.get_backend())
    UserGroupsResource(endpoint_name, app=app, service=service)
コード例 #6
0
def init_app(app):
    endpoint_name = 'legal_archive_consistency'
    service = BaseService(endpoint_name, backend=get_backend())
    LegalArchiveConsistencyResource(endpoint_name, app=app, service=service)

    endpoint_name = 'consistency'
    service = ConsistencyRecordService(endpoint_name, backend=get_backend())
    ConsistencyRecordResource(endpoint_name, app=app, service=service)
コード例 #7
0
def init_app(app):
    endpoint_name = "media_references"
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    MediaReferencesResource(endpoint_name, app=app, service=service)

    endpoint_name = "media_editor"
    service = MediaEditorService(endpoint_name,
                                 backend=superdesk.get_backend())
    MediaEditorResource(endpoint_name, app=app, service=service)
コード例 #8
0
def init_app(app):
    """Initialize the `publish` API endpoint.

    :param app: the API application object
    :type app: `Eve`
    """
    endpoint_name = 'publish'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    PublishResource(endpoint_name, app=app, service=service)
コード例 #9
0
def init_app(app) -> None:
    app.auth = SuperdeskTokenAuth()  # Overwrite the app default auth

    endpoint_name = "auth_users"
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    AuthUsersResource(endpoint_name, app=app, service=service)

    endpoint_name = "sessions"
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    SessionsResource(endpoint_name, app=app, service=service)

    endpoint_name = "clear_sessions"
    service = UserSessionClearService(endpoint_name,
                                      backend=superdesk.get_backend())
    UserSessionClearResource(endpoint_name, app=app, service=service)

    endpoint_name = "auth"
    service = AuthService(endpoint_name, backend=superdesk.get_backend())
    AuthResource(endpoint_name, app=app, service=service)
コード例 #10
0
def init_app(app):
    endpoint_name = 'activity'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    ActivityResource(endpoint_name, app=app, service=service)

    endpoint_name = 'audit'
    service = AuditService(endpoint_name, backend=superdesk.get_backend())
    AuditResource(endpoint_name, app=app, service=service)
    app.on_inserted += service.on_generic_inserted
    app.on_updated += service.on_generic_updated
    app.on_deleted_item += service.on_generic_deleted
コード例 #11
0
ファイル: __init__.py プロジェクト: superdesk/superdesk-core
def init_app(app) -> None:
    endpoint_name = "media_references"
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    MediaReferencesResource(endpoint_name, app=app, service=service)

    endpoint_name = "media_editor"
    service = MediaEditorService(endpoint_name,
                                 backend=superdesk.get_backend())
    MediaEditorResource(endpoint_name, app=app, service=service)

    app.client_config.setdefault("media", {}).update(
        {"renditions": app.config.get("RENDITIONS")})
コード例 #12
0
def create_de_item(archive_service: BaseService,
                   item: dict) -> Tuple[str, dict]:
    """Duplicate item and return new id and updates to use for German item"""
    updates = {
        PUBLISH_SCHEDULE: item[PUBLISH_SCHEDULE],
        SCHEDULE_SETTINGS: item[SCHEDULE_SETTINGS],
        'language': 'de',
    }

    new_id = archive_service.duplicate_item(item, state='routed')
    updates[ITEM_STATE] = item.get(ITEM_STATE)
    updates[PROCESSED_FROM] = item[config.ID_FIELD]
    return new_id, updates
コード例 #13
0
ファイル: __init__.py プロジェクト: vladnicoara/superdesk
def init_app(app):
    endpoint_name = 'auth'
    service = DbAuthService(endpoint_name, backend=superdesk.get_backend())
    AuthResource(endpoint_name, app=app, service=service)

    endpoint_name = 'reset_user_password'
    service = ResetPasswordService(endpoint_name, backend=superdesk.get_backend())
    ResetPasswordResource(endpoint_name, app=app, service=service)

    endpoint_name = 'change_user_password'
    service = ChangePasswordService(endpoint_name, backend=superdesk.get_backend())
    ChangePasswordResource(endpoint_name, app=app, service=service)

    endpoint_name = 'active_tokens'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    ActiveTokensResource(endpoint_name, app=app, service=service)
コード例 #14
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)
コード例 #15
0
ファイル: __init__.py プロジェクト: superdesk/superdesk-core
def init_app(app) -> None:
    endpoint_name = "auth_db"
    service: Any = DbAuthService("auth", backend=superdesk.get_backend())
    AuthResource(endpoint_name, app=app, service=service)

    endpoint_name = "reset_user_password"
    service = ResetPasswordService(endpoint_name,
                                   backend=superdesk.get_backend())
    ResetPasswordResource(endpoint_name, app=app, service=service)

    endpoint_name = "change_user_password"
    service = ChangePasswordService(endpoint_name,
                                    backend=superdesk.get_backend())
    ChangePasswordResource(endpoint_name, app=app, service=service)

    endpoint_name = "active_tokens"
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    ActiveTokensResource(endpoint_name, app=app, service=service)
コード例 #16
0
def init_app(app):
    """Initialize assignments

    :param app: superdesk app
    """

    assignments_lock_service = AssignmentsLockService(AssignmentsLockResource.endpoint_name,
                                                      backend=superdesk.get_backend())
    AssignmentsLockResource(AssignmentsLockResource.endpoint_name, app=app, service=assignments_lock_service)

    assignments_unlock_service = AssignmentsUnlockService(AssignmentsUnlockResource.endpoint_name,
                                                          backend=superdesk.get_backend())
    AssignmentsUnlockResource(AssignmentsUnlockResource.endpoint_name, app=app, service=assignments_unlock_service)

    assignments_publish_service = AssignmentsService('assignments', backend=superdesk.get_backend())
    AssignmentsResource('assignments', app=app, service=assignments_publish_service)

    assignments_content_service = AssignmentsContentService('assignments_content', backend=superdesk.get_backend())
    AssignmentsContentResource('assignments_content', app=app, service=assignments_content_service)

    assignments_link_service = AssignmentsLinkService('assignments_link', backend=superdesk.get_backend())
    AssignmentsLinkResource('assignments_link', app=app, service=assignments_link_service)

    assignments_unlink_service = AssignmentsUnlinkService('assignments_unlink', backend=superdesk.get_backend())
    AssignmentsUnlinkResource('assignments_unlink', app=app, service=assignments_unlink_service)

    assignments_complete_service = AssignmentsCompleteService(AssignmentsCompleteResource.endpoint_name,
                                                              backend=superdesk.get_backend())
    AssignmentsCompleteResource(
        AssignmentsCompleteResource.endpoint_name,
        app=app,
        service=assignments_complete_service
    )

    assignments_revert_service = AssignmentsRevertService(AssignmentsRevertResource.endpoint_name,
                                                          backend=superdesk.get_backend())
    AssignmentsRevertResource(
        AssignmentsRevertResource.endpoint_name,
        app=app,
        service=assignments_revert_service
    )

    assignments_history_service = AssignmentsHistoryService('assignments_history', backend=superdesk.get_backend())
    AssignmentsHistoryResource('assignments_history', app=app, service=assignments_history_service)
    app.on_updated_assignments += assignments_history_service.on_item_updated
    app.on_deleted_item_assignments += assignments_history_service.on_item_deleted

    delivery_service = BaseService('delivery', backend=superdesk.get_backend())
    DeliveryResource('delivery', app=app, service=delivery_service)

    # Updating data/lock on assignments based on content item updates from authoring
    app.on_updated_archive += assignments_publish_service.update_assignment_on_archive_update
    app.on_archive_item_updated += assignments_publish_service.update_assignment_on_archive_operation
    app.on_item_lock += assignments_publish_service.validate_assignment_lock
    app.on_item_locked += assignments_publish_service.sync_assignment_lock
    app.on_item_unlocked += assignments_publish_service.sync_assignment_unlock

    # Remove Assignment and Coverage upon deleting an Archive Rewrite
    app.on_deleted_resource_archive_rewrite += assignments_publish_service.unlink_assignment_on_delete_archive_rewrite

    # Enhance the archive/published item resources with assigned desk/user information
    app.on_fetched_resource_archive += assignments_publish_service.on_fetched_resource_archive
    app.on_fetched_item_archive += assignments_publish_service.on_fetched_item_archive
    app.on_fetched_resource_published += assignments_publish_service.on_fetched_resource_archive
    app.on_fetched_item_published += assignments_publish_service.on_fetched_resource_archive
    app.on_updated_archive_spike += assignments_unlink_service.on_spike_item

    # Privileges
    superdesk.intrinsic_privilege(AssignmentsUnlockResource.endpoint_name, method=['POST'])
コード例 #17
0
def init_app(app):
    endpoint_name = 'spikes'
    service = BaseService(endpoint_name, backend=get_backend())
    SpikesResource(endpoint_name, app=app, service=service)
コード例 #18
0
def init_app(app):
    endpoint_name = 'activity_report'
    service = BaseService(endpoint_name, backend=get_backend())
    ActivityReportResource(endpoint_name, app=app, service=service)
コード例 #19
0
def init_app(app):
    endpoint_name = 'media_references'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    MediaReferencesResource(endpoint_name, app=app, service=service)
コード例 #20
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 = 'saved_searches'
    service = SavedSearchesService(endpoint_name,
                                   backend=superdesk.get_backend())
    SavedSearchesResource(endpoint_name, app=app, service=service)

    endpoint_name = 'all_saved_searches'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    AllSavedSearchesResource(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='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'])
コード例 #21
0
def init_app(app):
    endpoint_name = 'tokens'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    TokensResource(endpoint_name, app=app, service=service)
コード例 #22
0
def init_app(app):
    endpoint_name = 'traffic_incidents'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    IncidentsMapResource(endpoint_name, app=app, service=service)
コード例 #23
0
def init_app(app):
    endpoint_name = 'fuel'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    FuelMapResource(endpoint_name, app=app, service=service)
コード例 #24
0
def init_app(app):
    """Initialize assignments

    :param app: superdesk app
    """

    assignments_lock_service = AssignmentsLockService(
        AssignmentsLockResource.endpoint_name, backend=superdesk.get_backend())
    AssignmentsLockResource(AssignmentsLockResource.endpoint_name,
                            app=app,
                            service=assignments_lock_service)

    assignments_unlock_service = AssignmentsUnlockService(
        AssignmentsUnlockResource.endpoint_name,
        backend=superdesk.get_backend())
    AssignmentsUnlockResource(AssignmentsUnlockResource.endpoint_name,
                              app=app,
                              service=assignments_unlock_service)

    assignments_publish_service = AssignmentsService(
        'assignments', backend=superdesk.get_backend())
    AssignmentsResource('assignments',
                        app=app,
                        service=assignments_publish_service)

    assignments_content_service = AssignmentsContentService(
        'assignments_content', backend=superdesk.get_backend())
    AssignmentsContentResource('assignments_content',
                               app=app,
                               service=assignments_content_service)

    assignments_link_service = AssignmentsLinkService(
        'assignments_link', backend=superdesk.get_backend())
    AssignmentsLinkResource('assignments_link',
                            app=app,
                            service=assignments_link_service)

    assignments_unlink_service = AssignmentsUnlinkService(
        'assignments_unlink', backend=superdesk.get_backend())
    AssignmentsUnlinkResource('assignments_unlink',
                              app=app,
                              service=assignments_unlink_service)

    assignments_complete_service = AssignmentsCompleteService(
        AssignmentsCompleteResource.endpoint_name,
        backend=superdesk.get_backend())
    AssignmentsCompleteResource(AssignmentsCompleteResource.endpoint_name,
                                app=app,
                                service=assignments_complete_service)

    assignments_revert_service = AssignmentsRevertService(
        AssignmentsRevertResource.endpoint_name,
        backend=superdesk.get_backend())
    AssignmentsRevertResource(AssignmentsRevertResource.endpoint_name,
                              app=app,
                              service=assignments_revert_service)

    assignments_history_service = AssignmentsHistoryService(
        'assignments_history', backend=superdesk.get_backend())
    AssignmentsHistoryResource('assignments_history',
                               app=app,
                               service=assignments_history_service)
    app.on_updated_assignments += assignments_history_service.on_item_updated
    app.on_deleted_item_assignments += assignments_history_service.on_item_deleted

    delivery_service = BaseService('delivery', backend=superdesk.get_backend())
    DeliveryResource('delivery', app=app, service=delivery_service)

    # Updating data/lock on assignments based on content item updates from authoring
    app.on_updated_archive += assignments_publish_service.update_assignment_on_archive_update
    app.on_archive_item_updated += assignments_publish_service.update_assignment_on_archive_operation
    app.on_item_lock += assignments_publish_service.validate_assignment_lock
    app.on_item_locked += assignments_publish_service.sync_assignment_lock
    app.on_item_unlocked += assignments_publish_service.sync_assignment_unlock
    app.on_updated_events += assignments_publish_service.on_events_updated

    # Track updates for an assignment if it's news story was updated
    if app.config.get('PLANNING_LINK_UPDATES_TO_COVERAGES', True):
        app.on_inserted_archive_rewrite += assignments_publish_service.create_delivery_for_content_update

        # Remove Assignment and Coverage upon deleting an Archive Rewrite
        app.on_deleted_resource_archive_rewrite +=\
            assignments_publish_service.unlink_assignment_on_delete_archive_rewrite

    app.client_config['planning_check_for_assignment_on_publish'] = \
        app.config.get('PLANNING_CHECK_FOR_ASSIGNMENT_ON_PUBLISH', False)

    if len(app.config.get('PLANNING_FULFIL_ON_PUBLISH_FOR_DESKS', '')) == 0:
        app.client_config['planning_fulfil_on_publish_for_desks'] = []
    else:
        app.client_config['planning_fulfil_on_publish_for_desks'] = \
            app.config.get('PLANNING_FULFIL_ON_PUBLISH_FOR_DESKS', '').split(',')

    # Enhance the archive/published item resources with assigned desk/user information
    app.on_fetched_resource_archive += assignments_publish_service.on_fetched_resource_archive
    app.on_fetched_item_archive += assignments_publish_service.on_fetched_item_archive
    app.on_fetched_resource_published += assignments_publish_service.on_fetched_resource_archive
    app.on_fetched_item_published += assignments_publish_service.on_fetched_resource_archive
    app.on_updated_archive_spike += assignments_unlink_service.on_spike_item

    # Privileges
    superdesk.intrinsic_privilege(AssignmentsUnlockResource.endpoint_name,
                                  method=['POST'])

    # User Preferences
    superdesk.register_default_user_preference(
        'assignments:default_sort', {
            'type': 'dict',
            'label': 'Default sort preferences for Assignment lists',
            'category': 'assignments',
            'sort': {},
            'default': None
        })
コード例 #25
0
def init_app(app) -> None:
    endpoint_name = "spikes"
    service = BaseService(endpoint_name, backend=get_backend())
    SpikesResource(endpoint_name, app=app, service=service)
コード例 #26
0
def init_app(app):
    endpoint_name = 'companies'
    service = BaseService(endpoint_name, backend=superdesk.get_backend())
    CompaniesResource(endpoint_name, app=app, service=service)