Automatically assign workspace owner to environments
This commit is contained in:
@@ -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()
|
||||
|
||||
|
@@ -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"],
|
||||
|
Reference in New Issue
Block a user