Merge pull request #83 from dod-ccpo/users

Create dev users with roles, rather than specifying roles directly
This commit is contained in:
richard-dds 2018-07-23 10:19:26 -04:00 committed by GitHub
commit ee4d76f166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,35 +3,42 @@ import tornado.gen
from atst.handler import BaseHandler from atst.handler import BaseHandler
_DEV_USERS = { _DEV_USERS = {
"ccpo": { "sam": {
"id": "164497f6-c1ea-4f42-a5ef-101da278c012", "id": "164497f6-c1ea-4f42-a5ef-101da278c012",
"first_name": "Sam", "first_name": "Sam",
"last_name": "CCPO", "last_name": "CCPO",
"atat_role": "ccpo"
}, },
"owner": {
"amanda": {
"id": "cce17030-4109-4719-b958-ed109dbb87c8", "id": "cce17030-4109-4719-b958-ed109dbb87c8",
"first_name": "Olivia", "first_name": "Amanda",
"last_name": "Owner", "last_name": "Adamson",
"atat_role": "default"
}, },
"admin": { "brandon": {
"id": "66ebf7b8-cbf0-4ed8-a102-5f105330df75", "id": "66ebf7b8-cbf0-4ed8-a102-5f105330df75",
"first_name": "Andreas", "first_name": "Brandon",
"last_name": "Admin", "last_name": "Buchannan",
"atat_role": "default"
}, },
"developer": { "christina": {
"id": "7707b9f2-5945-49ae-967a-be65baa88baf", "id": "7707b9f2-5945-49ae-967a-be65baa88baf",
"first_name": "Dominick", "first_name": "Christina",
"last_name": "Developer", "last_name": "Collins",
"atat_role": "default"
}, },
"billing_auditor": { "dominick": {
"id": "6978ac0c-442a-46aa-a0c3-ff17b5ec2a8c", "id": "6978ac0c-442a-46aa-a0c3-ff17b5ec2a8c",
"first_name": "Billie", "first_name": "Dominick",
"last_name": "The Billing Auditor", "last_name": "Domingo",
"atat_role": "default"
}, },
"security_auditor": { "erica": {
"id": "596fd001-bb1d-4adf-87d8-fa2312e882de", "id": "596fd001-bb1d-4adf-87d8-fa2312e882de",
"first_name": "Sawyer", "first_name": "Erica",
"last_name": "The Security Auditor", "last_name": "Eichner",
"atat_role": "default"
}, },
} }
@ -44,9 +51,9 @@ class Dev(BaseHandler):
@tornado.gen.coroutine @tornado.gen.coroutine
def get(self): def get(self):
role = self.get_argument("role", "ccpo") role = self.get_argument("username", "amanda")
user = _DEV_USERS[role] user = _DEV_USERS[role]
yield self._set_user_permissions(user["id"], role) yield self._set_user_permissions(user["id"], user["atat_role"])
yield self.login(user) yield self.login(user)
@tornado.gen.coroutine @tornado.gen.coroutine