示例#1
0
 def post(self, project_id, member_id, role):
     if validate_user_role(role) == 0:
         return {
                    "message": "Not a valid user role."
                }, 401
     authorization_code = oauth2_flow.extract_auth_code(request)
     return ProjectController.add_user_to_project(project_id, member_id, role, authorization_code=authorization_code)
示例#2
0
 def post(self, project_id, member_id):
     #if validate_user_role(role) == 0:
     #    return {
     #               "message": "Not a valid user role."
     #           }, 401
     authorization_code = oauth2_flow.extract_auth_code(request)
     return ProjectController.remove_user_from_project(project_id, member_id,
                                                       authorization_code=authorization_code)
示例#3
0
def auth_code():
    auth_code = oauth2_flow.extract_auth_code(request)

    access_token = oauth2_flow.authenticate_using_auth_code(auth_code)
    print('access_token ({}): {}'.format(type(access_token), access_token))

    # TODO: replace access_token with BasicProfile
    return jsonify(access_token)
示例#4
0
    def post(self):
        payload = request.get_json()
        #data = validate_data(payload, ProjectSchema)
        data = payload
        authorization_code = oauth2_flow.extract_auth_code(request)

        owner_email = data.get('owner_email')

        if '@' not in owner_email:
            return {
                       "message": "Not a valid email."
                   }, 401

        if len(owner_email.split('@')) != 2:
            return {
                       "message": "Not a valid email."
                   }, 401

        domain = owner_email.split('@')[1]


        country = data.get(
            'country', os.environ.get('DEFAULT_COUNTRY')
        ).lower()

        # parent_id = data.get(
        #     'folder_id', os.environ.get('DEFAULT_PARENT_FOLDER_ID')
        # )

        application_code = data.get('application_code', os.environ.get(
            'DEFAULT_APPLICATION_CODE', 'FR-XXX'
        ))
        budget_code = data.get('budget_code', os.environ.get(
            'DEFAULT_BUDGET_CODE', 'FR-XXX'
        ))
        env = data.get('environment', os.environ.get(
            'DEFAULT_ENVIRONMENT', 'DEV'
        ))

        return ProjectController.deploy_project(
            owner_email=owner_email,
            # parent_id=parent_id,
            country=country,
            name=data.get('name'),
            env=env,
            authorization_code=authorization_code
        )
示例#5
0
 def get(self):
     authorization_code = oauth2_flow.extract_auth_code(request)
     return ProjectController.get_user_id(authorization_code=authorization_code)
示例#6
0
 def get(self, project_id):
     authorization_code = oauth2_flow.extract_auth_code(request)
     return ProjectController.get_project_policy(project_id, authorization_code=authorization_code)
示例#7
0
 def get(self):
     authorization_code = oauth2_flow.extract_auth_code(request)
     print("AUTHORIZATION CODE       :")
     print(authorization_code)
     return ProjectController.get_projects_info(authorization_code=authorization_code)