|
|
|
@ -38,9 +38,26 @@ class User extends AuthUser {
|
|
|
|
|
photo_file_id: String,
|
|
|
|
|
trap: String,
|
|
|
|
|
notify_config: NotifyConfig,
|
|
|
|
|
uid_number: Number,
|
|
|
|
|
}}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async get_uid_number() {
|
|
|
|
|
if ( !this.uid_number ) {
|
|
|
|
|
const Setting = this.models.get('Setting')
|
|
|
|
|
let last_uid = await Setting.get('ldap.last_alloc_uid')
|
|
|
|
|
if ( last_uid < 1 ) {
|
|
|
|
|
last_uid = this.configs.get('ldap:server.schema.start_uid')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.uid_number = last_uid + 1
|
|
|
|
|
await Setting.set('ldap.last_alloc_uid', this.uid_number)
|
|
|
|
|
await this.save()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this.uid_number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async photo() {
|
|
|
|
|
const File = this.models.get('upload::File')
|
|
|
|
|
return File.findById(this.photo_file_id)
|
|
|
|
@ -179,10 +196,13 @@ class User extends AuthUser {
|
|
|
|
|
sn: this.last_name,
|
|
|
|
|
gecos: `${this.first_name} ${this.last_name}`,
|
|
|
|
|
mail: this.email,
|
|
|
|
|
objectClass: ['inetOrgPerson', 'person'],
|
|
|
|
|
objectClass: ['inetOrgPerson', 'person', 'posixaccount'],
|
|
|
|
|
objectclass: ['inetOrgPerson', 'person', 'posixaccount'],
|
|
|
|
|
entryuuid: this.uuid,
|
|
|
|
|
entryUUID: this.uuid,
|
|
|
|
|
objectGuid: this.uuid,
|
|
|
|
|
objectguid: this.uuid,
|
|
|
|
|
uidnumber: await this.get_uid_number(),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( this.tagline ) ldap_data.extras_tagline = this.tagline
|
|
|
|
|