Esempio n. 1
0
def leave_group_member(gid, memberid):
    appid = request.appid
    if hasattr(request, "uid") and request.uid > 0:
        #群组管理员或者成员本身有权限退出群
        if memberid != request.uid:
            master = Group.get_group_master(g._imdb, gid)
            if master != request.uid:
                raise ResponseMeta(400, "no authority")


    remove_group_member(appid, gid, memberid)

    resp = {"success":True}
    return make_response(200, resp)
Esempio n. 2
0
def delete_group_member(gid):
    appid = request.appid
    if hasattr(request, "uid") and request.uid > 0:
        #群组管理员或者成员本身有权限退出群
        master = Group.get_group_master(g._imdb, gid)
        if master != request.uid:
            raise ResponseMeta(400, "no authority")

    members = json.loads(request.data)
    if len(members) == 0:
        raise ResponseMeta(400, "no memebers to delete")

    for memberid in members:
        remove_group_member(appid, gid, memberid)

    resp = {"success":True}
    return make_response(200, resp)
def delete_group(gid):
    appid = request.appid

    #群组管理员有权限解散群
    master = Group.get_group_master(g._db, gid)
    if master != request.uid:
        raise ResponseMeta(400, "no authority")

    Group.disband_group(g._db, gid)

    v = {"group_id": gid, "timestamp": int(time.time())}
    op = {"disband": v}
    send_group_notification(appid, gid, op, None)

    content = {"group_id": gid, "name": Group.GROUP_EVENT_DISBAND}
    publish_message(g.rds, content)

    resp = {"success": True}
    return make_response(200, resp)
Esempio n. 4
0
def delete_group(gid):
    appid = request.appid

    #群组管理员有权限解散群
    master = Group.get_group_master(g._db, gid)
    if master != request.uid:
        raise ResponseMeta(400, "no authority")
    
    Group.disband_group(g._db, gid)

    v = {
        "group_id":gid,
        "timestamp":int(time.time())
    }
    op = {"disband":v}
    send_group_notification(appid, gid, op, None)

    content = "%d"%gid
    publish_message(g.rds, "group_disband", content)

    resp = {"success":True}
    return make_response(200, resp)
def delete_group_member(gid):
    appid = request.appid

    #群组管理员有权限删除群成员
    master = Group.get_group_master(g._db, gid)
    if master != request.uid:
        raise ResponseMeta(400, "no authority")

    members = json.loads(request.data)
    if len(members) == 0:
        raise ResponseMeta(400, "no memebers to delete")

    for m in members:
        if type(m) == int:
            member = {"uid": m}
        else:
            member = m

        remove_group_member(appid, gid, member)

    resp = {"success": True}
    return make_response(200, resp)
Esempio n. 6
0
def delete_group_member(gid):
    appid = request.appid

    #群组管理员有权限删除群成员
    master = Group.get_group_master(g._db, gid)
    if master != request.uid:
        raise ResponseMeta(400, "no authority")

    members = json.loads(request.data)
    if len(members) == 0:
        raise ResponseMeta(400, "no memebers to delete")


    for m in members:
        if type(m) == int:
            member = {"uid":m}
        else:
            member = m
            
        remove_group_member(appid, gid, member)

    resp = {"success":True}
    return make_response(200, resp)