Added a entry parser for extensionAttribute7
This commit is contained in:
parent
07aaf99c17
commit
dc4f22853d
|
@ -5,25 +5,42 @@ const entryParser = (entry, raw, callback) => {
|
|||
)}`
|
||||
|
||||
if (raw.hasOwnProperty('pwdLastSet'))
|
||||
entry.pwdLastSet = ldapTimeToJSTime(raw.pwdLastSet)
|
||||
entry.pwdLastSet = ldapTimeToJSDate(raw.pwdLastSet)
|
||||
|
||||
if (raw.hasOwnProperty('badPasswordTime'))
|
||||
entry.badPasswordTime = ldapTimeToJSTime(raw.badPasswordTime)
|
||||
entry.badPasswordTime = ldapTimeToJSDate(raw.badPasswordTime)
|
||||
|
||||
if (raw.hasOwnProperty('lastLogon'))
|
||||
entry.lastLogon = ldapTimeToJSTime(raw.lastLogon)
|
||||
entry.lastLogon = ldapTimeToJSDate(raw.lastLogon)
|
||||
|
||||
if (raw.hasOwnProperty('lastLogonTimestamp'))
|
||||
entry.lastLogonTimestamp = ldapTimeToJSTime(raw.lastLogonTimestamp)
|
||||
entry.lastLogonTimestamp = ldapTimeToJSDate(raw.lastLogonTimestamp)
|
||||
|
||||
if (raw.hasOwnProperty('lockoutTime') && entry.lockoutTime !== '0')
|
||||
entry.lockoutTime = ldapTimeToJSTime(raw.lockoutTime)
|
||||
entry.lockoutTime = ldapTimeToJSDate(raw.lockoutTime)
|
||||
|
||||
if (raw.hasOwnProperty('extensionAttribute7'))
|
||||
entry.extensionAttribute7 = simpleDateToDate(entry.extensionAttribute7)
|
||||
|
||||
callback(entry)
|
||||
}
|
||||
|
||||
function ldapTimeToJSTime(ldapTime) {
|
||||
function ldapTimeToJSDate(ldapTime) {
|
||||
return new Date(ldapTime / 1e4 - 1.16444736e13)
|
||||
}
|
||||
|
||||
function simpleDateToDate(simpleDate) {
|
||||
// Accepts a yyyymmdd day and converts to Date
|
||||
|
||||
const year = simpleDate.substring(0, 4)
|
||||
const month = simpleDate.substring(4, 6)
|
||||
const day = simpleDate.substring(6, 8)
|
||||
|
||||
const date = new Date(year, month - 1, day)
|
||||
|
||||
console.log(date)
|
||||
|
||||
return date.toISOString()
|
||||
}
|
||||
|
||||
export { entryParser }
|
||||
|
|
|
@ -6,7 +6,7 @@ Vue.filter('dateAndTime', val =>
|
|||
format(new Date(val), "d 'de' MMMM 'de' yyyy 'às' HH:MM", { locale })
|
||||
)
|
||||
|
||||
Vue.filter('shortDate', val => format(val, 'dd/MM/yyyy', { locale }))
|
||||
Vue.filter('shortDate', val => format(new Date(val), 'dd/MM/yyyy', { locale }))
|
||||
|
||||
Vue.filter('from', val =>
|
||||
formatDistance(new Date(val), Date.now(), { locale, addSuffix: true })
|
||||
|
|
|
@ -31,10 +31,7 @@
|
|||
</v-card>
|
||||
<div class="text-center font-weight-light mt-5">
|
||||
Válido até
|
||||
{{
|
||||
tokenInfo.expiration
|
||||
| dateAndtime
|
||||
}}
|
||||
{{ tokenInfo.expiration | dateAndtime }}
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
|
Loading…
Reference in New Issue
Block a user