示例#1
0
def join_request(cm_id, caller_id, group_id):
    """
    Sends request for acceptation in specified Groupfor caller. Adds caller
    to members  with 'waiting' state.

    @clmview_user
    @param_post{group_id,int} id of the Group, which caller wants to become member of
    """
    group = Group.get(group_id)
    user = User.get(caller_id)

    mem = UserGroup()
    mem.user = user
    mem.group = group
    mem.status = group_states['waiting']

    message.info(group.leader_id,
                 'group_request',
                 params={
                     'first_name': user.first,
                     'last_name': user.last,
                     'group_name': group.name,
                     'group_id': group.id
                 })
    try:
        mem.save()
    except:
        raise CLMException('group_request')
示例#2
0
文件: group.py 项目: cc1-cloud/cc1
def create(cm_id, caller_id, name, description):
    """
    Creates new Group of Users. Caller becomes its leader. He also becomes a
    member of that Group with @val{ok} state.

    @clmview_user
    @param_post{name,string}
    @param_post{description,string}
    """
    user = User.get(caller_id)

    # create group
    group = Group()
    group.leader = user
    group.name = name
    group.desc = description
    group.save()

    # create first membership
    mem = UserGroup()
    mem.user = user
    mem.group = group
    mem.status = group_states['ok']
    try:
        mem.save()
    except:
        raise CLMException('group_create')
示例#3
0
def create(cm_id, caller_id, name, description):
    """
    Creates new Group of Users. Caller becomes its leader. He also becomes a
    member of that Group with @val{ok} state.

    @clmview_user
    @param_post{name,string}
    @param_post{description,string}
    """
    user = User.get(caller_id)

    # create group
    group = Group()
    group.leader = user
    group.name = name
    group.desc = description
    group.save()

    # create first membership
    mem = UserGroup()
    mem.user = user
    mem.group = group
    mem.status = group_states['ok']
    try:
        mem.save()
    except:
        raise CLMException('group_create')
示例#4
0
文件: group.py 项目: cc1-cloud/cc1
def join_request(cm_id, caller_id, group_id):
    """
    Sends request for acceptation in specified Groupfor caller. Adds caller
    to members  with 'waiting' state.

    @clmview_user
    @param_post{group_id,int} id of the Group, which caller wants to become member of
    """
    group = Group.get(group_id)
    user = User.get(caller_id)

    mem = UserGroup()
    mem.user = user
    mem.group = group
    mem.status = group_states['waiting']

    message.info(group.leader_id, 'group_request', params={'first_name': user.first, 'last_name': user.last, 'group_name': group.name, 'group_id': group.id})
    try:
        mem.save()
    except:
        raise CLMException('group_request')