Make test admin users engineers
GitOrigin-RevId: 627b5b05eefdfa675937764b7c798e99ab6ef37e
This commit is contained in:
@@ -16,6 +16,7 @@ describe('AdminPrivilegeAvailable', function () {
|
||||
adminUser = new User()
|
||||
await adminUser.ensureUserExists()
|
||||
await adminUser.ensureAdmin()
|
||||
await adminUser.ensureAdminRole('engineering')
|
||||
await adminUser.login()
|
||||
})
|
||||
|
||||
|
||||
@@ -212,6 +212,7 @@ describe('Authorization', function () {
|
||||
this.other2 = new User()
|
||||
this.anon = new User()
|
||||
this.site_admin = new User({ email: 'admin@example.com' })
|
||||
settings.adminRolesEnabled = false
|
||||
await Promise.all([
|
||||
this.owner.login(),
|
||||
this.other1.login(),
|
||||
|
||||
@@ -579,6 +579,10 @@ class User {
|
||||
this.mongoUpdate({ $set: { isAdmin: true } }, callback)
|
||||
}
|
||||
|
||||
ensureAdminRole(role, callback) {
|
||||
this.mongoUpdate({ $addToSet: { adminRoles: 'engineering' } }, callback)
|
||||
}
|
||||
|
||||
ensureStaffAccess(flag, callback) {
|
||||
const update = { $set: {} }
|
||||
update.$set[`staffAccess.${flag}`] = true
|
||||
|
||||
Reference in New Issue
Block a user