예제 #1
0
def admin_role_create(context, data_dict):
    '''
    Authorization check for changing the details of a role
    '''    
    if not user_is_sysadmin(context):
        return {'success': False, 'msg': pt._('Only sysadmins can create new roles')}
    else:
        return {'success': True}
예제 #2
0
파일: get.py 프로젝트: enal/ckanext-authz
def roles_all_list(context, data_dict):
    '''
    Authorization check for getting the details of any current user roles    
    '''
    if not user_is_sysadmin(context):
        return {'success': False, 'msg': pt._('Only sysadmins can view current roles')}
    else:
        return {'success': True}
예제 #3
0
def harvest_job_create_all(context, data_dict):
    '''
        Authorization check for creating new jobs for all sources

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {'success': False, 'msg': pt._('Only sysadmins can create harvest jobs for all sources')}
    else:
        return {'success': True}
예제 #4
0
def harvest_sources_clear(context, data_dict):
    '''
        Authorization check for clearing history for all harvest sources

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {'success': False, 'msg': pt._('Only sysadmins can clear history for all harvest jobs')}
    else:
        return {'success': True}
예제 #5
0
def harvest_objects_import(context, data_dict):
    '''
        Authorization check reimporting all harvest objects

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {'success': False, 'msg': pt._('Only sysadmins can reimport all harvest objects')}
    else:
        return {'success': True}
예제 #6
0
def harvest_jobs_run(context, data_dict):
    '''
        Authorization check for running the pending harvest jobs

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {'success': False, 'msg': pt._('Only sysadmins can run the pending harvest jobs')}
    else:
        return {'success': True}
예제 #7
0
def harvest_sources_reindex(context, data_dict):
    '''
        Authorization check for reindexing all harvest sources

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {'success': False, 'msg': pt._('Only sysadmins can reindex all harvest sources')}
    else:
        return {'success': True}
def harvest_sources_reindex(context, data_dict):
    """
        Authorization check for reindexing all harvest sources

        Only sysadmins can do it
    """
    if not user_is_sysadmin(context):
        return {"success": False, "msg": pt._("Only sysadmins can reindex all harvest sources")}
    else:
        return {"success": True}
def harvest_jobs_run(context, data_dict):
    """
        Authorization check for running the pending harvest jobs

        Only sysadmins can do it
    """
    if not user_is_sysadmin(context):
        return {"success": False, "msg": pt._("Only sysadmins can run the pending harvest jobs")}
    else:
        return {"success": True}
def harvest_objects_import(context, data_dict):
    """
        Authorization check reimporting all harvest objects

        Only sysadmins can do it
    """
    if not user_is_sysadmin(context):
        return {"success": False, "msg": pt._("Only sysadmins can reimport all harvest objects")}
    else:
        return {"success": True}
예제 #11
0
def roles_all_list(context, data_dict):
    '''
    Authorization check for getting the details of any current user roles    
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg': pt._('Only sysadmins can view current roles')
        }
    else:
        return {'success': True}
예제 #12
0
def admin_role_delete(context, data_dict):
    '''
    Authorization check for changing the details of a role
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg': pt._('Only sysadmins can delete roles')
        }
    else:
        return {'success': True}
예제 #13
0
def dge_dashboard_update_drupal_comments(context, data_dict):
    '''
        Authorization check for update dge_dashboard_update_drupal_comments table

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg': pt._('Only sysadmins can update dge_dashboard tables')
        }
    else:
        return {'success': True}
예제 #14
0
def dge_dashboard_json_published_datasets(context, data_dict):
    '''
        Authorization check for get dge_dashboard_published_dataset table data

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg': pt._('Only sysadmins can get dge_dashboard table data')
        }
    else:
        return {'success': True}
예제 #15
0
def dge_dashboard_json_current_drupal_published_contents(context, data_dict):
    '''
        Authorization check for get drupal published data by content_type

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg': pt._('Only sysadmins can get drupal published data')
        }
    else:
        return {'success': True}
예제 #16
0
def dge_dashboard_json_current_assigned_request_by_state(context, data_dict):
    '''
        Authorization check for get drupal assigned requests

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg': pt._('Only sysadmins can get drupal assigned requests')
        }
    else:
        return {'success': True}
예제 #17
0
def dge_dashboard_json_current_users(context, data_dict):
    '''
        Authorization check for get drupal active users

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg': pt._('Only sysadmins can get drupal active users')
        }
    else:
        return {'success': True}
예제 #18
0
def dge_dashboard_json_visited_datasets(context, data_dict):
    '''
        Authorization check for get the most visited datasets

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg': pt._('Only sysadmins can get the most visited datasets')
        }
    else:
        return {'success': True}
예제 #19
0
def harvest_job_create_all(context, data_dict):
    '''
        Authorization check for creating new jobs for all sources

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg':
            pt._('Only sysadmins can create harvest jobs for all sources')
        }
    else:
        return {'success': True}
예제 #20
0
def dge_dashboard_json_current_distribution_format(context, data_dict):
    '''
        Authorization check for get distribution by format

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg':
            pt._('Only sysadmins can get number of distribution by format')
        }
    else:
        return {'success': True}
예제 #21
0
def dge_dashboard_csv_published_datasets_by_root_org(context, data_dict):
    '''
        Authorization check for get the most visited datasets

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success': False,
            'msg':
            pt._('Only sysadmins can get the datasets by root organization')
        }
    else:
        return {'success': True}
예제 #22
0
def dge_dashboard_json_current_publishers_by_administration_level(
        context, data_dict):
    '''
        Authorization check for get dge_dashboard_publishers table data

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success':
            False,
            'msg':
            pt.
            _('Only sysadmins can get number of current publisher by administration level'
              )
        }
    else:
        return {'success': True}
예제 #23
0
def dge_dashboard_json_current_published_datasets_by_category(
        context, data_dict):
    '''
        Authorization check for get published datasets by category

        Only sysadmins can do it
    '''
    if not user_is_sysadmin(context):
        return {
            'success':
            False,
            'msg':
            pt.
            _('Only sysadmins can get number of published datasets by category'
              )
        }
    else:
        return {'success': True}