add isFromInstance role condition
This commit is contained in:
parent
b8558fd8db
commit
56a8ff4f50
5 changed files with 54 additions and 1 deletions
|
|
@ -248,6 +248,19 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
|||
case 'isRemote': {
|
||||
return this.userEntityService.isRemoteUser(user);
|
||||
}
|
||||
// User is from a specific instance
|
||||
case 'isFromInstance': {
|
||||
if (user.host == null) {
|
||||
return false;
|
||||
}
|
||||
if (value.subdomains) {
|
||||
const userHost = '.' + user.host.toLowerCase();
|
||||
const targetHost = '.' + value.host.toLowerCase();
|
||||
return userHost.endsWith(targetHost);
|
||||
} else {
|
||||
return user.host.toLowerCase() === value.host.toLowerCase();
|
||||
}
|
||||
}
|
||||
// サスペンド済みユーザである
|
||||
case 'isSuspended': {
|
||||
return user.isSuspended;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue