split atat roles and workspace roles
This commit is contained in:
parent
a4f51fe01d
commit
7af7b47bc1
@ -5,7 +5,7 @@ from atst.models import Role, Permissions
|
||||
from .exceptions import NotFoundError
|
||||
|
||||
|
||||
DEFINITIONS = [
|
||||
ATAT_ROLES = [
|
||||
{
|
||||
"name": "ccpo",
|
||||
"display_name": "CCPO",
|
||||
@ -46,6 +46,14 @@ DEFINITIONS = [
|
||||
Permissions.VIEW_AUDIT_LOG,
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "default",
|
||||
"display_name": "Default",
|
||||
"description": "",
|
||||
"permissions": [Permissions.REQUEST_JEDI_WORKSPACE],
|
||||
},
|
||||
]
|
||||
WORKSPACE_ROLES = [
|
||||
{
|
||||
"name": "owner",
|
||||
"display_name": "Workspace Owner",
|
||||
@ -139,12 +147,6 @@ DEFINITIONS = [
|
||||
Permissions.VIEW_APPLICATION_IN_WORKSPACE,
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "default",
|
||||
"display_name": "Default",
|
||||
"description": "",
|
||||
"permissions": [Permissions.REQUEST_JEDI_WORKSPACE],
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from atst.domain.roles import DEFINITIONS as ROLE_DEFINITIONS
|
||||
from atst.domain.roles import WORKSPACE_ROLES as WORKSPACE_ROLE_DEFINITIONS
|
||||
|
||||
SERVICE_BRANCHES = [
|
||||
(None, "Select an option"),
|
||||
@ -107,8 +107,7 @@ COMPLETION_DATE_RANGES = [
|
||||
|
||||
WORKSPACE_ROLES = [
|
||||
(role["name"], {"name": role["display_name"], "description": role["description"]})
|
||||
for role in ROLE_DEFINITIONS
|
||||
if role["name"] not in ["ccpo", "default"]
|
||||
for role in WORKSPACE_ROLE_DEFINITIONS
|
||||
]
|
||||
|
||||
ENVIRONMENT_ROLES = [
|
||||
|
@ -9,11 +9,11 @@ from sqlalchemy.orm.exc import NoResultFound
|
||||
from atst.app import make_config, make_app
|
||||
from atst.database import db
|
||||
from atst.models import Role, Permissions
|
||||
from atst.domain.roles import DEFINITIONS
|
||||
from atst.domain.roles import ATAT_ROLES, WORKSPACE_ROLES
|
||||
|
||||
|
||||
def seed_roles():
|
||||
for role_info in DEFINITIONS:
|
||||
for role_info in ATAT_ROLES + WORKSPACE_ROLES:
|
||||
role = Role(**role_info)
|
||||
try:
|
||||
existing_role = db.session.query(Role).filter_by(name=role.name).one()
|
||||
|
Loading…
x
Reference in New Issue
Block a user