import makeAcl from './makeAcl' ; import { UserContext , AccessCapabilities } from './types' ; import { makeCluster } from '../clusters' ; export default function makeUserContext ( json ) { json = json || { } ; const username = json . userName ; const authType = json . authType ; const cluster = makeCluster ( json . cluster ) ; const acl = makeAcl ( json . userAcl ) ; const accessStrategy = json . accessStrategy || defaultStrategy ; const accessCapabilities = makeAccessCapabilities ( json . accessCapabilities ) ; return { username , authType , acl , cluster , accessStrategy , accessCapabilities , } ; } function makeAccessCapabilities ( json ) { json = json || { } ; return { requestableRoles : json . requestableRoles || [ ] , suggestedReviewers : json . suggestedReviewers || [ ] , } ; } export const defaultStrategy = { type : 'optional' , prompt : '' , } ;