示例#1
0
def submit_info(projectname, appname, applabel, module):
    if not session.get("uid"):
        return json_response_error(AUTH_ERROR)
    uid = session.get("uid")
    required_list = ("items",)
    data = check_required_params(request, required_list)
    # view logic
    return checklist_create(appname, projectname, applabel, module, uid, data["items"])
示例#2
0
文件: url.py 项目: smiledaddy/Crystal
def login(appname):
    required_list = ("user_name", "password")
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    # view logic
    return user_login(
        appname, data['user_name'], data['password'], session)
示例#3
0
def check_info(appname, projectname, applabel, module, id):
    if not session.get("uid"):
        return json_response_error(AUTH_ERROR)
    uid = session.get("uid")
    required_list = ("checked", "mark")
    data = check_required_params(request, required_list)
    data["uid"] = uid
    return check_content(appname, projectname, applabel, module, id, data)
示例#4
0
文件: url.py 项目: smiledaddy/Crystal
def add_app(appname, projectname):
    required_list = ('name', "app_value", "order")
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    # view logic
    return app_create(
        appname, projectname, data['name'], data["app_value"], data["order"])
示例#5
0
文件: url.py 项目: smiledaddy/Crystal
def del_right(appname):
    if not session.get('uid'):
        return json_response_error(AUTH_ERROR)
    required_list = ('pids', )
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    # view logic
    return right_delete(appname, data['pids'])
示例#6
0
文件: url.py 项目: smiledaddy/Crystal
def add_group(appname):
    if not session.get('uid'):
        return json_response_error(AUTH_ERROR)
    required_list = ("rolename", )
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    # view logic
    return group_create(appname, data['rolename'])
示例#7
0
文件: url.py 项目: smiledaddy/Crystal
def auth_right(appname):
    if not session.get('uid'):
        return json_response_error(AUTH_ERROR)
    required_list = ('perm_module', 'perm_opname', 'perm_action')
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    perm_lc = request.form.get('perm_lc', "all")
    return check_session(
        appname, data["perm_module"], data["perm_opname"],
        data["perm_action"], perm_lc, session["uid"])
示例#8
0
文件: url.py 项目: smiledaddy/Crystal
def add_user(appname):
    if not session.get('uid'):
        return json_response_error(AUTH_ERROR)
    required_list = ("user_name", "group_id")
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    add_data = ArmoryJson.decode(request.data)
    data["mark"] = add_data.get("mark", "")
    # view logic
    return user_create(appname, data)
示例#9
0
文件: url.py 项目: smiledaddy/Crystal
def chpasswd_user(appname):
    if not session.get('uid'):
        _LOGGER.error('cant find uid in session')
        return json_response_error(AUTH_ERROR)
    required_list = ("current_password", "new_password")
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    return user_chpasswd(
        appname, session.get('uid'), data['current_password'],
        data['new_password'])
示例#10
0
文件: url.py 项目: smiledaddy/Crystal
def right_info(appname, id):
    if request.method == 'GET':
        # this method get group right info by gid
        return right_get(appname, int(id))
    elif request.method == 'POST':
        # this method mod group right info
        data = check_required_params(request, Right.params)
        if isinstance(data, Response):
            return data
        return right_mod(appname, int(id), data)
    else:
        return json_response_error(METHOD_ERROR)
示例#11
0
文件: url.py 项目: smiledaddy/Crystal
def user_edit(appname, id):
    if request.method == 'GET':
        # this method get user info by uid
        return user_get(appname, int(id))
    elif request.method == 'POST':
        # this method mod user info
        data = check_required_params(request, User.params)
        if isinstance(data, Response):
            return data
        return user_mod(appname, int(id), data)
    else:
        return json_response_error(METHOD_ERROR)
示例#12
0
文件: url.py 项目: smiledaddy/Crystal
def user_right_info(appname, projectname, id):
    if request.method == 'GET':
        # this method get right info by gid
        return user_right_get(appname, projectname, int(id))
    elif request.method == 'POST':
        # this method mod user right info
        required_list = ("perm_list", "disable_list")
        data = check_required_params(request, required_list)
        if isinstance(data, Response):
            return data
        return user_right_mod(appname, projectname, int(id), data)
    else:
        return json_response_error(METHOD_ERROR)
示例#13
0
文件: url.py 项目: smiledaddy/Crystal
def add_right(appname, projectname):
    required_list = ('perm_module', 'perm_opname', 'perm_action', "perm_type")
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data

    action_value = ['list', 'add', 'edit', 'delete']
    if data["perm_type"] == "module" and \
            data["perm_action"] not in action_value:
        return json_response_error(PARAM_ERROR)
    perm_lc = request.form.get('perm_lc', "all")

    # view logic
    return right_create(
        appname, projectname, data["perm_module"], data["perm_opname"],
        data["perm_action"], data["perm_type"], perm_lc)
示例#14
0
文件: url.py 项目: smiledaddy/Crystal
def active_user(appname):
    required_list = ('id', 'is_active')
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    return user_active(appname, data)
示例#15
0
文件: url.py 项目: smiledaddy/Crystal
def list_navigate(appname):
    required_list = ('uid', )
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    return navigate_list(appname, data["uid"])
示例#16
0
文件: url.py 项目: smiledaddy/Crystal
def list_menu(appname, projectname):
    required_list = ('uid', )
    data = check_required_params(request, required_list)
    if isinstance(data, Response):
        return data
    return menu_list(appname, projectname, data["uid"])