예제 #1
0
def update_solution_baseinfo(**args):
    token = token_service.get_token(args.get('http_request'))
    user_login = token.username
    has_role = token.has_role('ROLE_MANAGER')

    solution = Solution()
    solution.__dict__ = solution_db.get_solution_by_id(args.get('solutionId'))

    if user_login != solution.authorLogin and not has_role:
        raise Exception('403 Forbidden')

    solution.name = args.get('name') if args.get('name') else ''
    solution.company = args.get('company') if args.get('company') else ''
    solution.version = args.get('version') if args.get('version') else ''
    solution.summary = args.get('summary') if args.get('summary') else ''
    solution.tag1 = args.get('tag1') if args.get('tag1') else ''
    solution.tag2 = args.get('tag2') if args.get('tag2') else ''
    solution.tag3 = args.get('tag3') if args.get('tag3') else ''
    solution.modelType = args.get('modelType') if args.get('modelType') else ''
    solution.toolkitType = args.get('toolkitType') if args.get(
        'toolkitType') else ''
    solution.modifiedDate = mytime.now()

    solution_db.update_solution_baseinfo(solution)
    return 0
예제 #2
0
def update_solution_name(**args):
    token = token_service.get_token(args.get('http_request'))
    user_login = token.username

    solution = Solution()
    solution.__dict__ = solution_db.get_solution_by_id(args.get('solutionId'))

    if user_login != solution.authorLogin:
        raise Exception('403 Forbidden')

    solution.name = args.get('name')
    solution.modifiedDate = mytime.now()

    solution_db.update_solution_name(solution)
    return 0