Ejemplo n.º 1
0
def fun_update_group_article(user=None, group_id='-1', article_id = '-1', article_type='blog', title='', summary='', body='',
                     permission='public', keys=[], classes=[], father_id='-1', father_type='blog', do="post"):

    try:
        group = BasicGroup(_id=group_id)
        limit = group.authority_verify(user)
        #print 'User limit ', limit
    except Exception, e:
        logging.error(traceback.format_exc())
        logging.error('Group not exist %s' % group_id)
        return [1, '小组不存在!']
Ejemplo n.º 2
0
def fun_update_group_article(user=None,
                             group_id='-1',
                             article_id='-1',
                             article_type='blog',
                             title='',
                             summary='',
                             body='',
                             permission='public',
                             keys=[],
                             classes=[],
                             father_id='-1',
                             father_type='blog',
                             do="post"):

    try:
        group = BasicGroup(_id=group_id)
        limit = group.authority_verify(user)
        #print 'User limit ', limit
    except Exception, e:
        logging.error(traceback.format_exc())
        logging.error('Group not exist %s' % group_id)
        return [1, '小组不存在!']
Ejemplo n.º 3
0
         logging.error(traceback.format_exc())
         logging.error('%s not exist, id %s' % (article_type, article_id))
         AF_Object = Blog()
         AF_Object.author = user
         AF_Object.env = user
         article_id = str(AF_Object._id)
         isnew = True       
         (user.drafts_lib).add_obj(AF_Object)     
 elif article_type == "comment":
     return [1, '完善中']
 elif article_type in Group_Article:
     # for group
     isnew = False
     try:
         group = BasicGroup(_id=group_id)
         limit = group.authority_verify(user)
     except Exception, e:
         logging.error(traceback.format_exc())
         logging.error('Group not exist, id %s' % group_id)
         return [1, '参数错误,小组不存在!']
     
     class_map = { 'group-info': About, 'group-doc': Blog, 'group-feedback': Feedback, 
         'group-notice': Bulletin, 'group-topic': Topic}
         
     user_role = group.get_member_type(user)
     if user_role is None:
         return [1, '您不是该小组成员!']
     if article_type in ['group-info', 'group-doc', 'group-notice']:
         if user_role != 'Manager':
             return [1, '您不是管理员,无权操作!']
     
Ejemplo n.º 4
0
            logging.error(traceback.format_exc())
            logging.error('%s not exist, id %s' % (article_type, article_id))
            AF_Object = Blog()
            AF_Object.author = user
            AF_Object.env = user
            article_id = str(AF_Object._id)
            isnew = True
            (user.drafts_lib).add_obj(AF_Object)
    elif article_type == "comment":
        return [1, '完善中']
    elif article_type in Group_Article:
        # for group
        isnew = False
        try:
            group = BasicGroup(_id=group_id)
            limit = group.authority_verify(user)
        except Exception, e:
            logging.error(traceback.format_exc())
            logging.error('Group not exist, id %s' % group_id)
            return [1, '参数错误,小组不存在!']

        class_map = {
            'group-info': About,
            'group-doc': Blog,
            'group-feedback': Feedback,
            'group-notice': Bulletin,
            'group-topic': Topic
        }

        user_role = group.get_member_type(user)
        if user_role is None: