import { IGroupTemplate } from "../types" ; import { IUser } from "@esri/arcgis-rest-types" ; import { cloneObject , getWithDefault , includes } from "@esri/hub-common" ; param { object } user param { object } template returns { object } export function applyPrivPropValuesToTemplate ( user , template ) { const templateCopy = cloneObject ( template ) ; const ppv = getWithDefault ( template , "config.privPropValues" , [ ] ) ; ppv . forEach ( ( entry ) => { if ( includes ( user . privileges , entry . priv ) ) { templateCopy [ entry . prop ] = entry . value ; } } ) ; return templateCopy ; }