feat(plugin): Manage users — VNCdirectory deep-link settings-section
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Manage users — SRC Advisory webmail plugin.
|
||||
*
|
||||
* Adds a first-class "User management" entry to the Settings page. Users are
|
||||
* the VNCdirectory's concern (the SRC directory), so this plugin is a thin
|
||||
* deep-link: it explains where users live and opens the directory's user list
|
||||
* in a new tab. It deliberately does NOT try to manage users itself.
|
||||
*/
|
||||
|
||||
const host = require('@plugin-host');
|
||||
const React = require('react');
|
||||
const h = React.createElement;
|
||||
|
||||
const MANAGE_USERS_URL = 'https://vncdirectory.src-advisory.com/users';
|
||||
|
||||
const card = {
|
||||
border: '1px solid var(--color-border, #e2e8f0)',
|
||||
borderRadius: '8px',
|
||||
padding: '16px',
|
||||
background: 'var(--color-card, #fff)',
|
||||
color: 'var(--color-foreground, #0f172a)',
|
||||
maxWidth: '720px',
|
||||
};
|
||||
const btnPrimary = {
|
||||
font: 'inherit',
|
||||
padding: '8px 14px',
|
||||
borderRadius: '6px',
|
||||
border: '1px solid var(--color-primary, #2563eb)',
|
||||
background: 'var(--color-primary, #2563eb)',
|
||||
color: '#fff',
|
||||
cursor: 'pointer',
|
||||
};
|
||||
|
||||
function SettingsSection() {
|
||||
return h('div', { style: card },
|
||||
h('div', { style: { fontWeight: 600, marginBottom: '6px' } }, 'User management'),
|
||||
h('div', { style: { fontSize: '13px', lineHeight: 1.5, marginBottom: '14px', color: 'var(--color-muted-foreground, #64748b)' } },
|
||||
'Users are created and managed in the VNCdirectory, not in SRCmail. ' +
|
||||
'Add a user there and assign them to the SRC organization to give them a mailbox automatically.'),
|
||||
h('button', {
|
||||
type: 'button',
|
||||
style: btnPrimary,
|
||||
onClick: () => {
|
||||
try { host.ui.openExternalUrl(MANAGE_USERS_URL); } catch (err) {
|
||||
// Fallback if the sandbox blocks window.open: navigate a normal link.
|
||||
window.open(MANAGE_USERS_URL, '_blank', 'noopener,noreferrer');
|
||||
}
|
||||
},
|
||||
}, 'Open VNCdirectory →'),
|
||||
);
|
||||
}
|
||||
|
||||
export const slots = {
|
||||
'settings-section': { component: SettingsSection, order: 100 },
|
||||
};
|
||||
|
||||
export async function activate(api) {
|
||||
api.log.info('manage-users plugin activated');
|
||||
}
|
||||
Reference in New Issue
Block a user