Add get project method
This commit is contained in:
parent
c26854e26e
commit
9c9374541b
@ -1,4 +1,5 @@
|
|||||||
from atst.database import db
|
from atst.database import db
|
||||||
|
from atst.domain.exceptions import NotFoundError
|
||||||
from atst.models.project import Project
|
from atst.models.project import Project
|
||||||
from atst.domain.environments import Environments
|
from atst.domain.environments import Environments
|
||||||
|
|
||||||
@ -13,3 +14,17 @@ class Projects(object):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return project
|
return project
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get(cls, user, workspace, project_id):
|
||||||
|
# TODO: this should check permission for this particular project
|
||||||
|
Authorization.check_workspace_permission(
|
||||||
|
user, workspace, Permissions.VIEW_APPLICATION_IN_WORKSPACE,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
project = db.session.query(Project).filter_by(id=project_id).one()
|
||||||
|
except NoResultFound:
|
||||||
|
raise NotFoundError("project")
|
||||||
|
|
||||||
|
return project
|
||||||
|
Loading…
x
Reference in New Issue
Block a user