Automatically assign workspace owner to environments

This commit is contained in:
richard-dds
2018-09-10 13:35:16 -04:00
parent 59a5b2da5a
commit 996596f2b3
6 changed files with 9 additions and 4 deletions

View File

@@ -8,10 +8,13 @@ from atst.models.project import Project
class Projects(object):
@classmethod
def create(cls, workspace, name, description, environment_names):
def create(cls, user, workspace, name, description, environment_names):
project = Project(workspace=workspace, name=name, description=description)
Environments.create_many(project, environment_names)
for environment in project.environments:
Environments.add_member(user, environment, user)
db.session.add(project)
db.session.commit()

View File

@@ -112,6 +112,7 @@ def create_project(workspace_id):
if form.validate():
project_data = form.data
Projects.create(
g.current_user,
workspace,
project_data["name"],
project_data["description"],