Remove parse function

This commit is contained in:
Douglas Barone 2022-08-10 14:06:03 -04:00
parent 302e0cc60a
commit b52e310d41
2 changed files with 6 additions and 7 deletions

View File

@ -1,16 +1,14 @@
const parseSAMAccountName = sAMAccountName => // const parseSAMAccountName = sAMAccountName =>
sAMAccountName ? sAMAccountName.replace('.', ' ') : '' // sAMAccountName ? sAMAccountName.replace('.', ' ') : ''
export async function users( export async function users(
parent, parent,
{ where: { cn, displayName, sAMAccountName }, limit, onlyStudents }, { where: { cn, displayName, sAMAccountName }, limit, onlyStudents },
{ ad } { ad }
) { ) {
const parsedSAMAccountName = parseSAMAccountName(sAMAccountName)
const studentGroup = process.env.STUDENT_GROUP || 'Estudantes' const studentGroup = process.env.STUDENT_GROUP || 'Estudantes'
const search = `|(sAMAccountName=*${parsedSAMAccountName}*)(cn=*${cn}*)(displayName=*${displayName}*)` const search = `|(sAMAccountName=*${sAMAccountName}*)(cn=*${cn}*)(displayName=*${displayName}*)`
const filter = onlyStudents const filter = onlyStudents
? `(&(memberOf=CN=${studentGroup},OU=Groups,DC=ifms,DC=edu,DC=br)(${search}))` ? `(&(memberOf=CN=${studentGroup},OU=Groups,DC=ifms,DC=edu,DC=br)(${search}))`
@ -22,6 +20,7 @@ export async function users(
sizeLimit: limit sizeLimit: limit
}) })
console.dir(users)
return users.map(user => ({ ...user, roles: [] })) || [] return users.map(user => ({ ...user, roles: [] })) || []
} catch (e) { } catch (e) {
throw new Error('Não foi possível realizar a busca.') throw new Error('Não foi possível realizar a busca.')

View File

@ -1,2 +1,2 @@
VUE_APP_GRAPHQL_HTTP="http://10.7.0.54:4000/graphql" VUE_APP_GRAPHQL_HTTP="http://10.7.1.1:4000/graphql"
VUE_APP_GRAPHQL_WS="ws://10.7.0.54:4000/graphql" VUE_APP_GRAPHQL_WS="ws://10.7.1.1:4000/graphql"