Beispiel #1
0
def leave_project(project_id, request_user):
    get_chain_for_update(project_id)

    membership = get_membership(project_id, request_user.id)
    if not membership.can_leave():
        m = _(astakos_messages.NOT_ACCEPTED_MEMBERSHIP)
        raise PermissionDenied(m)

    project = membership.project
    leave_project_checks(project)

    auto_accepted = False
    leave_policy = project.application.member_leave_policy
    if leave_policy == AUTO_ACCEPT_POLICY:
        membership.remove()
        qh_sync_user(request_user)
        logger.info("User %s has left %s." %
                    (request_user.log_display, project))
        auto_accepted = True
    else:
        membership.leave_request()
        logger.info("User %s requested to leave %s." %
                    (request_user.log_display, project))
        membership_leave_request_notify(project, membership.person)
    return auto_accepted
Beispiel #2
0
def leave_project(project_id, request_user):
    get_chain_for_update(project_id)

    membership = get_membership(project_id, request_user.id)
    if not membership.can_leave():
        m = _(astakos_messages.NOT_ACCEPTED_MEMBERSHIP)
        raise PermissionDenied(m)

    project = membership.project
    leave_project_checks(project)

    auto_accepted = False
    leave_policy = project.application.member_leave_policy
    if leave_policy == AUTO_ACCEPT_POLICY:
        membership.remove()
        qh_sync_user(request_user)
        logger.info("User %s has left %s." %
                    (request_user.log_display, project))
        auto_accepted = True
    else:
        membership.leave_request()
        logger.info("User %s requested to leave %s." %
                    (request_user.log_display, project))
        membership_leave_request_notify(project, membership.person)
    return auto_accepted
Beispiel #3
0
def leave_project(memb_id, request_user, reason=None):
    project = get_project_of_membership_for_update(memb_id)
    membership = get_membership_by_id(memb_id)
    leave_project_checks(membership, request_user)

    auto_accepted = False
    leave_policy = project.application.member_leave_policy
    if leave_policy == AUTO_ACCEPT_POLICY:
        membership.perform_action("remove", actor=request_user, reason=reason)
        qh_sync_user(request_user)
        logger.info("User %s has left %s." %
                    (request_user.log_display, project))
        auto_accepted = True
    else:
        membership.perform_action("leave_request", actor=request_user,
                                  reason=reason)
        logger.info("User %s requested to leave %s." %
                    (request_user.log_display, project))
        membership_leave_request_notify(project, membership.person)
    return auto_accepted
Beispiel #4
0
def leave_project(memb_id, request_user, reason=None):
    project = get_project_of_membership_for_update(memb_id)
    membership = get_membership_by_id(memb_id)
    leave_project_checks(membership, request_user)

    auto_accepted = False
    leave_policy = project.application.member_leave_policy
    if leave_policy == AUTO_ACCEPT_POLICY:
        membership.perform_action("remove", actor=request_user, reason=reason)
        qh_sync_user(request_user)
        logger.info("User %s has left %s." %
                    (request_user.log_display, project))
        auto_accepted = True
    else:
        membership.perform_action("leave_request",
                                  actor=request_user,
                                  reason=reason)
        logger.info("User %s requested to leave %s." %
                    (request_user.log_display, project))
        membership_leave_request_notify(project, membership.person)
    return auto_accepted