core&ui: add allow invite option

This commit is contained in:
undefined committed 2025-11-20 23:42:53 +08:00
1 parent 6c5db5e997
commit 88e86d8667
3 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -175,7 +175,7 @@ class DomainUserHandler extends ManageHandler {
@param('role', Types.Role)
@param('join', Types.Boolean)
async postSetUsers(domainId: string, uid: number[], role: string, join = false) {
if (join) this.checkPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN);
if (join && !system.get('server.allowInvite')) this.checkPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN);
await Promise.all([
domain.setUserRole(domainId, uid, role),
oplog.log(this, 'domain.setRole', { uid, role, join }),
+1
View File
@@ -314,6 +314,7 @@ SystemSetting(Schema.object({
verify: Schema.boolean().default(true).description('Verify register email'),
}).extra('family', 'setting_smtp'),
server: Schema.object({
allowInvite: Schema.boolean().default(true).description('Allow invite users'),
center: Schema.string().default('https://hydro.ac/center').description('Server Center').role('url').hidden(),
name: Schema.string().default('Hydro').description('Server Name'),
url: Schema.string().default('/').description('Server BaseURL'),
@@ -1,7 +1,7 @@
{% extends "domain_base.html" %}
{% block domain_content %}
{{ set(UiContext, 'roles', roles.map(eval('(i) => i._id'))) }}
{{ set(UiContext, 'canForceJoin', handler.user.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN)) }}
{{ set(UiContext, 'canForceJoin', model.system.get('server.allowInvite') or handler.user.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN)) }}
{% set _rolesSelect = roles.filter(eval("(i) => i._id !== 'guest'")).map(eval('(role) => [role._id, role._id]')) %}
<div class="section">
<div class="section__header">