当前位置: 首页>>代码示例>>Python>>正文


Python utils.check_auth函数代码示例

本文整理汇总了Python中utils.check_auth函数的典型用法代码示例。如果您正苦于以下问题:Python check_auth函数的具体用法?Python check_auth怎么用?Python check_auth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_auth函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: web_add_user

def web_add_user(request):

    result = {'success': False}
    #if True:
    try:
    
        user, token = check_auth(request)
        
        organization_id = request.POST['organization_id']
        user_type_id = request.POST['user_type_id']
        first = request.POST['first']
        last = request.POST['last']
        email = request.POST['email']
        password = request.POST['password']

        
        new_user = add_user(
            user = user,
            organization_id = organization_id,
            user_type_id = user_type_id,
            first = first,
            last = last,
            email = email,
            password = password,
        )
        
        result['new_user_id'] = new_user.id
        
        result['success'] = True
        
    except:
        pass
        
    return make_response(result)
开发者ID:thequbit,项目名称:bits,代码行数:34,代码来源:views.py

示例2: web_complete_task

def web_complete_task(request):

    """ Complete a task
    """

    result = {'user': None}
    result['success'] = False

    #if True:
    try:

        user, token = check_auth(request)

        task_id = request.POST['task_id']
        
        task = complete_task(user, task_id);

        result['task_id'] = task.id

        result['success'] = True

    except:
       pass

    return make_response(result)
开发者ID:thequbit,项目名称:bits,代码行数:25,代码来源:views.py

示例3: web_close_ticket

def web_close_ticket(request):

    """ Create a new ticket
    """

    result = {'user': None}
    result['success'] = False

    #if True:
    try:

        user, token = check_auth(request)

        ticket_id = request.POST['ticket_id']
        
        ticket = close_ticket(user, ticket_id);

        result['ticket_id'] = ticket.id

        result['success'] = True

    except:
        pass

    return make_response(result)
开发者ID:thequbit,项目名称:bits,代码行数:25,代码来源:views.py

示例4: decorated

	def decorated(*args, **kwargs):
		auth = request.authorization
		if not auth:
			return authenticate()
		elif not check_auth(auth.username, auth.password):
			return authenticate()
		return f(*args, **kwargs)
开发者ID:cassac,项目名称:api_demo,代码行数:7,代码来源:messages.py

示例5: web_assign_user_to_project

def web_assign_user_to_project(request):
    """ Assign a user to a project
    """

    result = {}
    #if True:
    try:

        user, token = check_auth(request)
        
        project_id = int(request.POST['project_id'])
        email = request.POST['email']

        target_user, assignment = assign_user_to_project(
            user = user,
            project_id = project_id,
            email = email,
        )
    
        if assignment != None:
            result['assignment_id'] = assignment.id
        else:
            result['assignment_id'] = -1;
            
        result['project_id'] =  project_id
        result['user_id'] = target_user.id
    
        result['success'] = True

    except:
        pass

    return make_response(result)
开发者ID:thequbit,项目名称:bits,代码行数:33,代码来源:views.py

示例6: upload

    def upload():

        if 'client' in config and 'user' in config["client"] and 'pass' in config["client"]:
            auth_control = check_auth(config)
            if auth_control:
                return auth_control

        _file = request.files.get("file")
        if not _file:
            return "a file named as 'file' required", 400

        if not allowed_file(_file.filename, config):
            return "invalid file type", 400

        filename = secure_filename(_file.filename)
        full_filename = os.path.join(app.config['UPLOAD_FOLDER'], filename)

        try:
            full_filename = get_available_filename(full_filename)
        except ValueError as error:
            return error.message, 400

        _file.save(full_filename)

        return os.path.split(full_filename)[1], 201
开发者ID:carriercomm,项目名称:usta,代码行数:25,代码来源:server.py

示例7: web_tasks

def web_tasks(request):

    result = {'user': None}
    #if True:
    try:

        user, token = check_auth(request)
        result['user'] = user

        project_id = int(request.GET['project_id'])

        completed = False
        try:
            completed = int(request.GET['completed']);
        except:
            pass

        result['completed'] = completed

        result['tasks'] = get_tasks(project_id, completed)

        result['project'] = get_project(user.id, project_id)

    except:
        pass

    return result 
开发者ID:thequbit,项目名称:bits,代码行数:27,代码来源:views.py

示例8: web_ticket

def web_ticket(request):

    result = {'user': None}
    #if True:
    try:

        user, token = check_auth(request)
        result['user'] = user

        ticket_id = request.GET['ticket_id']
        #project_id = request.GET['project_id']

        ticket = get_ticket(
            user_id = user.id, 
            ticket_id = ticket_id,
        )
        
        result['ticket'] = ticket

        result['comments'] = get_ticket_comments(user.id, ticket['id'])

        result['tickets'] = get_tickets(ticket['project_id'])

        result['assigned_users'] = get_users_assigned_to_project(user.id, ticket['project_id'])

        result['project'] = get_project(user.id, ticket['project_id'])

    except:
        pass

    return result
开发者ID:thequbit,项目名称:bits,代码行数:31,代码来源:views.py

示例9: web_owner_tickets

def web_owner_tickets(request):

    result = {'user': None}
    #if True:
    try:

        user, token = check_auth(request)
        result['user'] = user

        project_id = int(request.GET['project_id'])

        result['tickets'] = get_tickets(
            project_id = project_id,
            closed = False,
            unassigned = False,
            user_id = user.id,
            opened = True,
        )

        result['project'] = get_project(user.id, project_id)

    except:
        pass

    return result 
开发者ID:thequbit,项目名称:bits,代码行数:25,代码来源:views.py

示例10: web_projects

def web_projects(request):

    result = {'user': None}
    #if True:
    try:

        user, token = check_auth(request)
        result['user'] = user

        result['projects'] = get_user_projects(user) #build_index_projects(user, limit=25)

        #project_id = request.GET['project_id']
            
        #result['project'] = get_project(user.id, project_id)

        #result['tasks'] = get_tasks(project_id, completed=False)

        #result['tickets'] = get_tickets(project_id)

        #result['lists'] = [] #get_lists(project_id)

    except:
        pass

    return result
开发者ID:thequbit,项目名称:bits,代码行数:25,代码来源:views.py

示例11: web_task

def web_task(request):

    result = {'user': None}
    #if True:
    try:

        user, token = check_auth(request)
        result['user'] = user

        task_id = request.GET['task_id']
        #project_id = request.GET['project_id']

        task = get_task(task_id)
        result['task'] = task

        result['comments'] = get_task_comments(task['id'])

        result['tasks'] = get_tasks(task['project_id'], completed=False)

        result['project'] = get_project(user.id, task['project_id'])


    except:
        pass

    return result
开发者ID:thequbit,项目名称:bits,代码行数:26,代码来源:views.py

示例12: web_create_task

def web_create_task(request):
    """ Get all of the organizations that the user has access to
    """
    
    result = {'user': None}
    result['success'] = False

    #if True:
    try:

        user, token = check_auth(request)

        project_id = request.POST['project_id']
        title = request.POST['title']
        contents = request.POST['contents']
        assigned_id = request.POST['assigned_id']
        due = request.POST['due']

        task = create_new_task(
            user = user,
            project_id = project_id,
            title = title,
            contents = contents,
            assigned_id = assigned_id,
            due = due,
        )
        
        result['task_id'] = task.id;
        
        result['success'] = True

    except:
        pass

    return make_response(result)
开发者ID:thequbit,项目名称:bits,代码行数:35,代码来源:views.py

示例13: web_assign_user_to_ticket

def web_assign_user_to_ticket(request):

    result = {'success': False}
    
    #if True:
    try:
    
        user, token = check_auth(request)
    
        ticket_id = request.POST['ticket_id']
        email = request.POST['email']
        
        unassign = False
        try:
            unassign = str2bool(request.POST['unassign'])
        except:
            pass
            
        assign_user_to_ticket(
            user = user,
            ticket_id = ticket_id,
            email = email,
            unassign = unassign,
        )
    
        result['ticket_id'] = ticket_id
    
        result['success'] = True
    
    except:
        pass

    return make_response(result)
开发者ID:thequbit,项目名称:bits,代码行数:33,代码来源:views.py

示例14: web_update_ticket_title

def web_update_ticket_title(request):

    result = {'success': False}

    #if True:
    try:

        user, token = check_auth(request)

        ticket_id = request.POST['ticket_id']
        title = request.POST['title']

        update_ticket_title(
            user = user,
            ticket_id = ticket_id,
            title = title,
        )

        result['ticket_id'] = ticket_id

        result['success'] = True

    except:
        pass

    return make_response(result)
开发者ID:thequbit,项目名称:bits,代码行数:26,代码来源:views.py

示例15: web_projectsettings

def web_projectsettings(request):

    result = {'user': None}
    #if True:
    try:

        user, token = check_auth(request)
        result['user'] = user

        project_id = request.GET['project_id']
            
        result['project'] = get_project(user.id, project_id)

        result['organization_users'] = get_organization_users(user.organization_id);
        
        result['assigned_users'] = get_users_assigned_to_project(user.id, project_id)

        result['tasks'] = get_tasks(project_id)

        result['tickets'] = get_tickets(project_id)


    except:
        pass

    return result
开发者ID:thequbit,项目名称:bits,代码行数:26,代码来源:views.py


注:本文中的utils.check_auth函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。