import { IUser } from "@esri/arcgis-rest-auth" ; import { hasAllPrivileges } from "./has-all-privileges" ; import { getProp , HubProduct , includes } from "@esri/hub-common" ; import { IGroupTemplate } from "../types" ; param { object } user param { string } product param { object } template export function canUserCreateTeamInProduct ( user , product , template ) { let result = false ; const userGroups = getProp ( user , "groups" ) || [ ] ; if ( userGroups . length < 507 && includes ( template . config . availableIn , product ) ) { result = hasAllPrivileges ( user , template . config . requiredPrivs ) ; } return result ; }