Esempio n. 1
0
def push_add(account_dir, box_dir):
    title = request.form["title"]
    desc = request.form["desc"]
    re = biz.box_usable(account_dir, box_dir)
    if re.errcode == model.HAVEDIR:

        try:
            re = biz.box_biz.box_user_level(account_dir, box_dir, session["dir"])
            if re.errcode != model.OK:
                lev = 0
            else:
                lev = re.data
        except KeyError:
            lev = 0

        if lev == 3:
            user_id = biz.get_id_by_dir(session["dir"])

            box = biz.box_biz.get_box(account_dir, box_dir)

            push = model.Push(box.data.id, user_id.data, title, desc)

            biz.push_biz.add_push(push)

            return redirect(url_for("push_view", account_dir=account_dir, box_dir=box_dir))
    else:
        return render_template(config.VIEW + "/404.html")
Esempio n. 2
0
File: box.py Progetto: aneashi/bthub
def box_set_admin_view(account_dir, box_dir):
	re = biz.box_usable(account_dir, box_dir)
	if re.errcode == model.HAVEDIR :
	
		try:
			re = biz.box_biz.box_user_level(account_dir, box_dir,session['dir']) 
			if re.errcode != model.OK :
				lev = 0
			else :
				lev = re.data
		except KeyError:
			lev = 0
		v = biz.account_biz.visit_dir(account_dir)
		box = biz.box_biz.get_box(account_dir, box_dir)
		admin = biz.get_account_by_id(box.data.admin)
		box.data.admin = admin.data
		
		if lev<3 :
			return "权限不足"
		
		
		
		return render_template(config.VIEW+'/box_set_admin.html', box = box.data, account=v.data, account_dir=account_dir, box_dir=box_dir, lev=lev)
	else :
		return render_template(config.VIEW+'/404.html')
Esempio n. 3
0
def push_del(account_dir, box_dir, id):
    re = biz.box_usable(account_dir, box_dir)
    if re.errcode == model.HAVEDIR:

        try:
            re = biz.box_biz.box_user_level(account_dir, box_dir, session["dir"])
            if re.errcode != model.OK:
                lev = 0
            else:
                lev = re.data
        except KeyError:
            lev = 0

        if lev > 2:
            re = biz.remove_push(id)
        return redirect(url_for("push_view", account_dir=account_dir, box_dir=box_dir))
Esempio n. 4
0
File: box.py Progetto: aneashi/bthub
def box_set_admin(account_dir, box_dir):
	admin_dir = request.form['admin']
	re = biz.box_usable(account_dir, box_dir)
	
	try:
		re = biz.box_biz.box_user_level(account_dir, box_dir,session['dir']) 
		if re.errcode != model.OK :
			lev = 0
		else :
			lev = re.data
	except KeyError:
			lev = 0
	
	if lev<3 :
		return "权限不足"
	else:
		biz.change_box_admin(account_dir, box_dir, admin_dir)
	
	return redirect(url_for('box_set_admin_view', account_dir=account_dir, box_dir = box_dir))	
Esempio n. 5
0
def push_view(account_dir, box_dir):
    re = biz.box_usable(account_dir, box_dir)
    if re.errcode == model.HAVEDIR:

        try:
            re = biz.box_biz.box_user_level(account_dir, box_dir, session["dir"])
            if re.errcode != model.OK:
                lev = 0
            else:
                lev = re.data
        except KeyError:
            lev = 0

        v = biz.account_biz.visit_dir(account_dir)
        box = biz.box_biz.get_box(account_dir, box_dir)
        files = biz.box_biz.get_box_file(account_dir, box_dir)

        pushs = biz.show_box_pushs(box.data.id)

        if pushs.errcode != model.OK:
            pushs = None
        else:
            pushs = pushs.data

        return render_template(
            config.VIEW + "/push.html",
            box=box.data,
            account=v.data,
            account_dir=account_dir,
            box_dir=box_dir,
            files=files,
            lev=lev,
            pushs=pushs,
        )
    else:
        return render_template(config.VIEW + "/404.html")