mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
49e19cad64
Add group and institution membership and management info to subscription dashboard GitOrigin-RevId: 1aba5d5a20cd00ff5090811d0f66dc9c4944dd60
19 lines
878 B
CoffeeScript
19 lines
878 B
CoffeeScript
UserGetter = require '../User/UserGetter'
|
|
UserMembershipHandler = require "../UserMembership/UserMembershipHandler"
|
|
UserMembershipEntityConfigs = require "../UserMembership/UserMembershipEntityConfigs"
|
|
logger = require 'logger-sharelatex'
|
|
|
|
module.exports = InstitutionsGetter =
|
|
getConfirmedInstitutions: (userId, callback = (error, institutions) ->) ->
|
|
UserGetter.getUserFullEmails userId, (error, emailsData) ->
|
|
return callback error if error?
|
|
|
|
confirmedInstitutions = emailsData.filter (emailData) ->
|
|
emailData.confirmedAt? and emailData.affiliation?.institution?.confirmed
|
|
.map (emailData) ->
|
|
emailData.affiliation?.institution
|
|
|
|
callback(null, confirmedInstitutions)
|
|
|
|
getManagedInstitutions: (user_id, callback = (error, managedInstitutions) ->) ->
|
|
UserMembershipHandler.getEntitiesByUser UserMembershipEntityConfigs.institution, user_id, callback
|