示例#1
0
@main.route('/api/user')
def get_user_details():
    session_id = get_session_id(session, request)
    b = Borg()
    emailName = b.settings[session_id]['dbUser']
    userName = b.settings[session_id]['userName']
    user_dict = {'name': userName, 'email': emailName}
    resp = make_response(encode(user_dict), OK)
    resp.headers['Content-type'] = 'application/json'
    return resp


# Architectural Pattern routes
api.add_resource(ArchitecturalPatternController.ArchitecturalPatternsAPI,
                 '/api/architectural_patterns',
                 endpoint='architecturalpatterns')
api.add_resource(ArchitecturalPatternController.ArchitecturalPatternByNameAPI,
                 '/api/architectural_patterns/name/<string:name>',
                 endpoint='architecturalpattern')
api.add_resource(
    ArchitecturalPatternController.ComponentGoalModelAPI,
    '/api/architectural_patterns/component/goal/model/<string:component>',
    endpoint='componentgoals')
api.add_resource(
    ArchitecturalPatternController.ComponentAssetModelAPI,
    '/api/architectural_patterns/component/asset/model/<string:component>',
    endpoint='componentassets')
api.add_resource(
    ArchitecturalPatternController.ComponentModelAPI,
    '/api/architectural_patterns/component/model/<string:ap_name>',
示例#2
0
文件: views.py 项目: edwinlu/cairis
  if (b.mailServer != '' and b.mailPort != '' and b.mailUser != '' and b.mailPasswd != ''):
    return render_template('register_user.html')
  else:
    return render_template('no_self_service.html')

@main.route('/reset')
def resetUser():
  b = Borg()
  if (b.mailServer != '' and b.mailPort != '' and b.mailUser != '' and b.mailPasswd != ''):
    return render_template('forgot_password.html')
  else:
    return render_template('no_self_service.html')


# Architectural Pattern routes
api.add_resource(ObjectController.ObjectsAPI, '/api/architectural_patterns',endpoint='architecturalpatterns',resource_class_kwargs={'dao': 'ArchitecturalPatternDAO'})
api.add_resource(ObjectController.ObjectByNameAPI, '/api/architectural_patterns/name/<path:name>',endpoint='architecturalpattern',resource_class_kwargs={'dao' : 'ArchitecturalPatternDAO'})
api.add_resource(ObjectController.ModelByParameterAPI, '/api/architectural_patterns/component/goal/model/<path:parameter_string>',endpoint='componentgoals',resource_class_kwargs={'dao' : 'ArchitecturalPatternDAO','get_method' : 'get_component_goal_model','renderer' : 'dot'})
api.add_resource(ObjectController.ModelByParameterAPI, '/api/architectural_patterns/component/asset/model/<path:parameter_string>',endpoint='componentassets',resource_class_kwargs={'dao' : 'ArchitecturalPatternDAO','get_method' : 'get_component_asset_model','renderer' : 'dot'})
api.add_resource(ObjectController.ModelByParameterAPI, '/api/architectural_patterns/component/model/<path:parameter_string>',endpoint='componentmodel',resource_class_kwargs={'dao' : 'ArchitecturalPatternDAO','get_method' : 'get_component_model','renderer' : 'dot'})
api.add_resource(ObjectController.ObjectsByMethodAndTwoParametersAPI, '/api/architectural_patterns/name/<path:p1>/environment/<path:p2>/weakness_analysis',endpoint='weakness_analysis',resource_class_kwargs={'dao' : 'ArchitecturalPatternDAO','get_method' : 'get_weakness_analysis'})
api.add_resource(ObjectController.ObjectsByMethodAndTwoParametersAPI, '/api/architectural_patterns/name/<path:p1>/environment/<path:p2>/situate',endpoint='situate',resource_class_kwargs={'dao' : 'ArchitecturalPatternDAO','post_method' : 'situate_component_view','post_message' : 'Architectural Pattern successfully situated'})

# Asset routes
api.add_resource(ObjectController.ObjectsAPI, '/api/assets',endpoint='assets',resource_class_kwargs={'dao': 'AssetDAO'})
api.add_resource(ObjectController.ObjectByNameAPI, '/api/assets/name/<path:name>',endpoint='asset',resource_class_kwargs={'dao' : 'AssetDAO'})
api.add_resource(ObjectController.ObjectsSummaryAPI, '/api/assets/summary',endpoint='assetssummary',resource_class_kwargs={'dao' : 'AssetDAO'})
api.add_resource(ObjectController.ObjectsByMethodAndParameterAPI, '/api/assets/environment/<path:parameter_string>/names',endpoint='assetbyenvironmentname',resource_class_kwargs={'dao' : 'AssetDAO','get_method' : 'get_asset_names_by_environment'})
api.add_resource(ObjectController.ObjectsByMethodAPI, '/api/assets/all/names',endpoint='assetnames',resource_class_kwargs={'dao' : 'AssetDAO','get_method' : 'get_asset_names', 'path_parameters' : [('environment','')]})
api.add_resource(ObjectController.ObjectsByMethodAPI, '/api/assets/types',endpoint='assettypes',resource_class_kwargs={'dao' : 'AssetDAO','get_method' : 'get_asset_types', 'post_method' : 'add_asset_type', 'path_parameters' : [('environment','')], 'isType' : True})
api.add_resource(ObjectController.ObjectsByMethodAndParameterAPI, '/api/assets/types/name/<path:parameter_string>',endpoint='assettypebyname',resource_class_kwargs={'dao' : 'AssetDAO','get_method' : 'get_asset_type_by_name', 'put_method' : 'update_asset_type','del_method' : 'delete_asset_type', 'path_parameters' : [('environment','')], 'isType' : True})
示例#3
0
    return send_from_directory(fixed_img_path, path)
  elif os.path.exists(upload_img_path):
    return send_from_directory(upload_img_path, path)
  else:
    try:
      b = Borg()
      web_img_dir = os.path.join(b.staticDir, 'images')
      return send_from_directory(web_img_dir, path)
    except AttributeError:
      return send_from_directory('static/images', path)


  return handle_error(err)

# Architectural Pattern routes
api.add_resource(ArchitecturalPatternController.ArchitecturalPatternsAPI, '/api/architectural_patterns', endpoint = 'architecturalpatterns')
api.add_resource(ArchitecturalPatternController.ArchitecturalPatternByNameAPI, '/api/architectural_patterns/name/<string:name>', endpoint='architecturalpattern')
api.add_resource(ArchitecturalPatternController.ComponentGoalModelAPI, '/api/architectural_patterns/component/goal/model/<string:component>', endpoint = 'componentgoals')
api.add_resource(ArchitecturalPatternController.ComponentAssetModelAPI, '/api/architectural_patterns/component/asset/model/<string:component>', endpoint = 'componentassets')

# Asset routes
api.add_resource(AssetController.AssetsAPI, '/api/assets',endpoint='assets')
api.add_resource(AssetController.AssetByNameAPI, '/api/assets/name/<string:name>',endpoint='assetbyname')
api.add_resource(AssetController.AssetByEnvironmentNamesAPI, '/api/assets/environment/<string:environment>/names',endpoint='assetbyenvironmentname')
api.add_resource(AssetController.AssetByIdAPI, '/api/assets/id/<int:id>',endpoint='assetbyid')
api.add_resource(AssetController.AssetNamesAPI, '/api/assets/all/names',endpoint='assetnames')
api.add_resource(AssetController.AssetTypesAPI, '/api/assets/types',endpoint='assettypes')
api.add_resource(AssetController.AssetTypeByNameAPI, '/api/assets/types/name/<string:name>',endpoint='assettypebyname')
api.add_resource(AssetController.AssetValuesAPI, '/api/environments/<string:environment_name>/asset-values',endpoint='assetvalues')
api.add_resource(AssetController.AssetValueByNameAPI, '/api/environments/<string:environment_name>/asset-values/name/<string:name>',endpoint='assetvaluebyname')
api.add_resource(AssetController.AssetModelAPI, '/api/assets/model/environment/<string:environment>/asset/<string:asset>',endpoint='assetmodel')
示例#4
0
文件: views.py 项目: failys/cairis
    return send_from_directory(distDir, 'default-avatar.png')

@main.route('/api/user')
def get_user_details():
  session_id = get_session_id(session, request)
  b = Borg()
  emailName = b.settings[session_id]['dbUser'] 
  userName = b.settings[session_id]['userName']
  user_dict = {'name' : userName, 'email' : emailName}
  resp = make_response(encode(user_dict), OK)
  resp.headers['Content-type'] = 'application/json'
  return resp


# Architectural Pattern routes
api.add_resource(ArchitecturalPatternController.ArchitecturalPatternsAPI, '/api/architectural_patterns', endpoint = 'architecturalpatterns')
api.add_resource(ArchitecturalPatternController.ArchitecturalPatternByNameAPI, '/api/architectural_patterns/name/<string:name>', endpoint='architecturalpattern')
api.add_resource(ArchitecturalPatternController.ComponentGoalModelAPI, '/api/architectural_patterns/component/goal/model/<string:component>', endpoint = 'componentgoals')
api.add_resource(ArchitecturalPatternController.ComponentAssetModelAPI, '/api/architectural_patterns/component/asset/model/<string:component>', endpoint = 'componentassets')
api.add_resource(ArchitecturalPatternController.ComponentModelAPI, '/api/architectural_patterns/component/model/<string:ap_name>', endpoint = 'componentmodel')
api.add_resource(ArchitecturalPatternController.WeaknessAnalysisAPI, '/api/architectural_patterns/name/<string:architectural_pattern_name>/environment/<string:environment_name>/weakness_analysis', endpoint='architecturalweaknessanalysis')
api.add_resource(ArchitecturalPatternController.SituateArchitecturalPatternAPI, '/api/architectural_patterns/name/<string:architectural_pattern_name>/environment/<string:environment_name>/situate', endpoint='situatearchitecturalpattern')

# Asset routes
api.add_resource(AssetController.AssetsAPI, '/api/assets',endpoint='assets')
api.add_resource(AssetController.AssetsSummaryAPI, '/api/assets/summary',endpoint='assetssummary')
api.add_resource(AssetController.AssetByNameAPI, '/api/assets/name/<string:name>',endpoint='assetbyname')
api.add_resource(AssetController.AssetByEnvironmentNamesAPI, '/api/assets/environment/<string:environment>/names',endpoint='assetbyenvironmentname')
api.add_resource(AssetController.AssetNamesAPI, '/api/assets/all/names',endpoint='assetnames')
api.add_resource(AssetController.AssetTypesAPI, '/api/assets/types',endpoint='assettypes')
api.add_resource(AssetController.AssetTypeByNameAPI, '/api/assets/types/name/<string:name>',endpoint='assettypebyname')