Add default user to allow for default groups and IAM
This commit is contained in:
@@ -40,9 +40,24 @@ class User extends AuthUser {
|
||||
notify_config: NotifyConfig,
|
||||
uid_number: Number,
|
||||
login_shell: String,
|
||||
|
||||
is_default_user_for_coreid: { type: Boolean, default: false },
|
||||
}}
|
||||
}
|
||||
|
||||
async grant_defaults() {
|
||||
const default_user = await this.constructor.findOne({is_default_user_for_coreid: true, active: true})
|
||||
this.login_shell = default_user.login_shell
|
||||
this.roles = default_user.roles
|
||||
this.permissions = default_user.permissions
|
||||
|
||||
const groups = await default_user.groups()
|
||||
for ( const group of groups ) {
|
||||
group.user_ids.push(this.id)
|
||||
await group.save()
|
||||
}
|
||||
}
|
||||
|
||||
async get_uid_number() {
|
||||
if ( !this.uid_number ) {
|
||||
const Setting = this.models.get('Setting')
|
||||
|
||||
Reference in New Issue
Block a user