Пример #1
0
def create_new_person(uid, uid_is_owner=False):
    '''
    Create a new person.

    @param uid: User ID to attach to the person
    @type uid: int
    @param uid_is_owner: Is the uid provided owner of the new person?
    @type uid_is_owner: bool

    @return: the resulting person ID of the new person
    @rtype: int
    '''
    pid = tu.create_new_person(uid, uid_is_owner=uid_is_owner)

    return pid
Пример #2
0
def execute_action(action, pid, bibref, uid, userinfo='', comment=''):
    '''
    Executes the action, setting the last user right according to uid

    @param action: the action to perform
    @type action: string
    @param pid: the Person ID to perform the action on
    @type pid: int
    @param bibref: the bibref pair to perform the action for
    @type bibref: string
    @param uid: the internal user ID of the currently logged in user
    @type uid: int

    @return: success of the process
    @rtype: boolean
    '''
    pid = wash_integer_id(pid)

    if not action in ['confirm', 'assign', 'repeal', 'reset']:
        return False
    elif pid < 0:
        return False
    elif pid == -3:
        pid = tu.create_new_person(uid, uid_is_owner=False)
    elif not is_valid_bibref(bibref):
        return False

    user_level = _resolve_maximum_acces_rights(uid)[1]

    if action in ['confirm', 'assign']:
        tu.insert_user_log(userinfo, pid, 'assign', 'CMPUI_ticketcommit',
                           bibref, comment)
        tu.confirm_papers_to_person([pid], [[bibref]], user_level)
    elif action in ['repeal']:
        tu.insert_user_log(userinfo, pid, 'repeal', 'CMPUI_ticketcommit',
                           bibref, comment)
        tu.reject_papers_from_person([pid], [[bibref]], user_level)
    elif action in ['reset']:
        tu.insert_user_log(userinfo, pid, 'reset', 'CMPUI_ticketcommit',
                           bibref, comment)
        tu.reset_papers_flag([pid], [[bibref]])
    else:
        return False
    return True
def execute_action(action, pid, bibref, uid, userinfo='', comment=''):
    '''
    Executes the action, setting the last user right according to uid

    @param action: the action to perform
    @type action: string
    @param pid: the Person ID to perform the action on
    @type pid: int
    @param bibref: the bibref pair to perform the action for
    @type bibref: string
    @param uid: the internal user ID of the currently logged in user
    @type uid: int

    @return: success of the process
    @rtype: boolean
    '''
    pid = wash_integer_id(pid)

    if not action in ['confirm', 'assign', 'repeal', 'reset']:
        return False
    elif pid < 0:
        return False
    elif pid == -3:
        pid = tu.create_new_person(uid, uid_is_owner=False)
    elif not is_valid_bibref(bibref):
        return False

    user_level = _resolve_maximum_acces_rights(uid)[1]

    if action in ['confirm', 'assign']:
        tu.insert_user_log(userinfo, pid, 'assign', 'CMPUI_ticketcommit', bibref, comment)
        tu.confirm_papers_to_person([pid], [[bibref]], user_level)
    elif action in ['repeal']:
        tu.insert_user_log(userinfo, pid, 'repeal', 'CMPUI_ticketcommit', bibref, comment)
        tu.reject_papers_from_person([pid], [[bibref]], user_level)
    elif action in ['reset']:
        tu.insert_user_log(userinfo, pid, 'reset', 'CMPUI_ticketcommit', bibref, comment)
        tu.reset_papers_flag([pid], [[bibref]])
    else:
        return False
    return True
Пример #4
0
def create_new_person(uid, uid_is_owner=False):
    pid = tu.create_new_person(uid, uid_is_owner=False)
    return pid
def create_new_person(uid, uid_is_owner=False):
    pid = tu.create_new_person(uid, uid_is_owner=False)
    return pid