Example #1
0
def acceptMember(request):
    """
    チームに招待されたユーザを管理者が承認する
    """
    logger.info('チーム招待管理者承認')
    c = {}
    if request.method == "POST":
        invited_username = request.POST["invited_username"]

    print invited_username
    if invited_username:
        invited_user = SERVICES.selectUserById(invited_username)
        if invited_user is None:
            c.update({'form_message':MSGS.INVITE_ACCEPT_FAIL})
            return show(request, c)
    else:
        c.update({'form_message':MSGS.INVITE_ACCEPT_FAIL})
        return show(request, c)

    result = SERVICES.acceptMember(invited_user, SERVICES.selectTeamsByUser(request.user)[0])

    if result == 'success':
        c.update({'form_message': MSGS.INVITE_ACCEPT_SUCCESS})
    else:
        c.update({'form_message':MSGS.INVITE_ACCEPT_FAIL})

    return show(request, c)
Example #2
0
def activateUser(request):
    """
    ユーザを再稼動させる
    """
    logger.info('ユーザ再稼動')
    c = {}

    if request.method == "POST":
        username = request.POST['object_id']

    user = SERVICES.selectUserById(username)

    if user:
        result = SERVICES.activateUser(user)

    if result == 'success':
        c.update({'list_form_message': MSGS.ACTIVATE_USER_SUCCESS})
    else:
        c.update({'list_form_message':MSGS.ACTIVATE_USER_FAIL})

    return show(request, c)
Example #3
0
def deleteUser(request):
    """
    ユーザを削除する
    """
    logger.info('ユーザ削除')
    c = {}
    if request.method == "POST":
        username = request.POST["object_id"]

    user = SERVICES.selectUserById(username)

    if user:
        result = SERVICES.deleteUser(user)

    if result == 'success':
        c.update({'list_form_message': MSGS.DELETE_USER_SUCCESS})
    else:
        c.update({'list_form_message':MSGS.DELETE_USER_FAIL})


    return show(request, c)
Example #4
0
def deleteMember(request):
    """
    チームからメンバーを削除する
    """
    logger.info('チームメンバ^-削除')
    c = {}

    if request.method == "POST":
        username = request.POST["object_id"]
        team_id = request.POST["delete_from_id"]

    user = SERVICES.selectUserById(username)
    team = SERVICES.selectTeamById(team_id)

    if user and team:
        result = SERVICES.deleteMember(user, team)

    if result == 'success':
        c.update({'list_form_message': MSGS.DELETE_MEMBER_SUCCESS})
    else:
        c.update({'list_form_message':MSGS.DELETE_MEMBER_FAIL})


    return show(request, c)