fix role manage

This commit is contained in:
undefined committed 2020-04-27 19:07:56 +08:00
1 parent 15d43636c0
commit 42e534615e
34 files changed
+221 -314

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
with: with:
name: hydro name: hydro
path: dist path: .build
- run: | - run: |
cd ui cd ui
yarn yarn
+2
View File
@@ -34,6 +34,8 @@ async function run() {
require('./handler/user'); require('./handler/user');
require('./handler/contest'); require('./handler/contest');
require('./handler/training'); require('./handler/training');
require('./handler/discussion');
require('./handler/manage');
require('./handler/import'); require('./handler/import');
server.start(); server.start();
} }
+16 -8
View File
@@ -46,12 +46,14 @@ class DiscussionHandler extends Handler {
const pdoc = await problem.getById(docId); const pdoc = await problem.getById(docId);
if (!pdoc) throw new DiscussionNodeNotFoundError(type, docId); if (!pdoc) throw new DiscussionNodeNotFoundError(type, docId);
if (pdoc.hidden) this.checkPerm(PERM_VIEW_PROBLEM_HIDDEN); if (pdoc.hidden) this.checkPerm(PERM_VIEW_PROBLEM_HIDDEN);
this.title = pdoc.title; this.vnode = pdoc;
} else if (type === 'contest') { } else if (type === 'contest') {
const tdoc = await contest.get(docId); const tdoc = await contest.get(docId);
if (!tdoc) throw new DiscussionNodeNotFoundError(type, docId); if (!tdoc) throw new DiscussionNodeNotFoundError(type, docId);
this.title = tdoc.title; this.vnode = tdoc;
} else throw new DiscussionNodeNotFoundError(type, docId); } else throw new DiscussionNodeNotFoundError(type, docId);
this.vnode.parentType = type;
this.vnode.parentId = docId;
} }
} }
} }
@@ -62,7 +64,7 @@ class DiscussionMainHandler extends DiscussionHandler {
const udict = await user.getList(ddocs.map((ddoc) => ddoc.owner)); const udict = await user.getList(ddocs.map((ddoc) => ddoc.owner));
this.response.template = 'discussion_main_or_node.html'; this.response.template = 'discussion_main_or_node.html';
this.response.body = { this.response.body = {
ddocs, dpcount, udict, page, ddocs, dpcount, udict, page, page_name: 'discussion_main', vnode: {},
}; };
} }
} }
@@ -77,11 +79,17 @@ class DiscussionNodeHandler extends DiscussionHandler {
const udict = await user.getList(ddocs.map((ddoc) => ddoc.owner)); const udict = await user.getList(ddocs.map((ddoc) => ddoc.owner));
const path = [ const path = [
['discussion_main', '/discuss'], ['discussion_main', '/discuss'],
[this.title, null, true], [this.vnode.title, null, true],
]; ];
this.response.template = 'discussion_main_or_node.html'; this.response.template = 'discussion_main_or_node.html';
this.response.body = { this.response.body = {
ddocs, dpcount, udict, path, page, ddocs,
dpcount,
udict,
path,
page,
vnode: this.vnode,
page_name: 'discussion_node',
}; };
} }
} }
@@ -95,11 +103,11 @@ class DiscussionCreateHandler extends DiscussionHandler {
async get({ type, docId }) { async get({ type, docId }) {
const path = [ const path = [
['discussion_main', '/discuss'], ['discussion_main', '/discuss'],
[this.title, `/discuss/${type}/${docId}`, true], [this.vnode.title, `/discuss/${type}/${docId}`, true],
['discussion_create', null], ['discussion_create', null],
]; ];
this.response.template = 'discussion_create.html'; this.response.template = 'discussion_create.html';
this.response.body = { path, title: this.title }; this.response.body = { path, vnode: this.vnode };
} }
async post({ async post({
@@ -139,7 +147,7 @@ class DiscussionDetailHandler extends DiscussionHandler {
const udict = await user.getList(uids); const udict = await user.getList(uids);
const path = [ const path = [
['discussion_main', '/discuss'], ['discussion_main', '/discuss'],
[this.title, '/discuss/{type}', true], [this.vnode.title, '/discuss/{type}', true],
[this.ddoc.title, null, true], [this.ddoc.title, null, true],
]; ];
this.response.template = 'discussion_detail.html'; this.response.template = 'discussion_detail.html';
+19 -12
View File
@@ -3,11 +3,12 @@ const user = require('../model/user');
const builtin = require('../model/builtin'); const builtin = require('../model/builtin');
const { Route, Handler } = require('../service/server'); const { Route, Handler } = require('../service/server');
const { PERM_ADMIN } = require('../permission'); const { PERM_ADMIN } = require('../permission');
const { RoleAlreadyExistError } = require('../error'); const { RoleAlreadyExistError, ValidationError } = require('../error');
class ManageHandler extends Handler { class ManageHandler extends Handler {
async prepare() { async prepare() {
this.checkPerm(PERM_ADMIN); this.checkPerm(PERM_ADMIN);
this.system = await user.getById(0);
} }
} }
@@ -20,20 +21,21 @@ class ManageMainHandler extends ManageHandler {
class ManageDashboardHandler extends ManageHandler { class ManageDashboardHandler extends ManageHandler {
async get() { async get() {
this.response.template = 'domain_manage_dashboard.html'; this.response.template = 'domain_manage_dashboard.html';
this.response.body = { system: this.system };
} }
} }
class ManageEditHandler extends ManageHandler { class ManageEditHandler extends ManageHandler {
async get() { async get() {
this.response.template = 'domain_manage_edit.html'; this.response.template = 'domain_manage_edit.html';
this.response.body = { system: this.system };
} }
async post({ name, gravatar, bulletin }) { async post({ uname, gravatar, bio }) {
await Promise.all([ const unameLower = uname.trim().toLowerCase();
system.set('name', name), await user.setById(0, {
system.set('gravatar', gravatar), uname, unameLower, gravatar, bio,
system.set('bulletin', bulletin), });
]);
this.back(); this.back();
} }
} }
@@ -92,14 +94,19 @@ class ManageRoleHandler extends ManageHandler {
} }
async postAdd({ role }) { async postAdd({ role }) {
const roles = await user.getRoles(); const r = await user.getRole(role);
if (roles.includes(role)) throw new RoleAlreadyExistError(role); if (r) throw new RoleAlreadyExistError(role);
await user.setRole(role, builtin.PERM_DEFAULT); await user.addRole(role, builtin.PERM_DEFAULT);
this.back(); this.back();
} }
async postDelete({ role }) { async postDelete({ roles }) {
await user.deleteRoles(role); for (const role of roles) {
if (['admin', 'default', 'guest'].includes(role)) {
throw new ValidationError('role');
}
}
await user.deleteRoles(roles);
this.back(); this.back();
} }
} }
-3
View File
@@ -4,7 +4,6 @@ const token = require('../model/token');
const system = require('../model/system'); const system = require('../model/system');
const { sendMail } = require('../lib/mail'); const { sendMail } = require('../lib/mail');
const misc = require('../lib/misc'); const misc = require('../lib/misc');
const validator = require('../lib/validator');
const options = require('../options'); const options = require('../options');
const { PERM_REGISTER_USER, PERM_LOGGEDIN } = require('../permission'); const { PERM_REGISTER_USER, PERM_LOGGEDIN } = require('../permission');
const { const {
@@ -55,7 +54,6 @@ class UserRegisterHandler extends Handler {
} }
async post({ mail }) { async post({ mail }) {
validator.checkEmail(mail);
if (await user.getByEmail(mail, true)) throw new UserAlreadyExistError(mail); if (await user.getByEmail(mail, true)) throw new UserAlreadyExistError(mail);
this.limitRate('send_mail', 3600, 30); this.limitRate('send_mail', 3600, 30);
const t = await token.add( const t = await token.add(
@@ -112,7 +110,6 @@ class UserLostPassHandler extends Handler {
} }
async post({ mail }) { async post({ mail }) {
validator.checkEmail(mail);
const udoc = await user.getByEmail(mail); const udoc = await user.getByEmail(mail);
if (!udoc) throw new UserNotFoundError(mail); if (!udoc) throw new UserNotFoundError(mail);
const tid = await token.add( const tid = await token.add(
+5 -28
View File
@@ -3,6 +3,7 @@ const { ValidationError } = require('../error');
const RE_UID = /^-?\d+$/i; const RE_UID = /^-?\d+$/i;
const RE_PID = /^([a-zA-Z]+[a-zA-Z0-9]*)|$/i; const RE_PID = /^([a-zA-Z]+[a-zA-Z0-9]*)|$/i;
const RE_UNAME = /[^\s\u3000](.{,254}[^\s\u3000])?$/i; const RE_UNAME = /[^\s\u3000](.{,254}[^\s\u3000])?$/i;
const RE_ROLE = /^[_0-9A-Za-z]{1,256}$/i;
const RE_MAIL = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/i; const RE_MAIL = /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/i;
const isTitle = (s) => s && s.length < 64; const isTitle = (s) => s && s.length < 64;
@@ -11,6 +12,8 @@ const isUid = (s) => RE_UID.test(s);
const checkUid = (s) => { if (!isUid(s)) throw new ValidationError('uid'); else return s; }; const checkUid = (s) => { if (!isUid(s)) throw new ValidationError('uid'); else return s; };
const isUname = (s) => RE_UNAME.test(s); const isUname = (s) => RE_UNAME.test(s);
const checkUname = (s) => { if (!isUname(s)) throw new ValidationError('uname'); else return s; }; const checkUname = (s) => { if (!isUname(s)) throw new ValidationError('uname'); else return s; };
const isRole = (s) => RE_ROLE.test(s);
const checkRole = (s) => { if (!isRole(s)) throw new ValidationError('role'); else return s; };
const isPassword = (s) => s.length >= 5; const isPassword = (s) => s.length >= 5;
const checkPassword = (s) => { if (!isPassword(s)) throw new ValidationError('password'); else return s; }; const checkPassword = (s) => { if (!isPassword(s)) throw new ValidationError('password'); else return s; };
const isEmail = (s) => RE_MAIL.test(s); const isEmail = (s) => RE_MAIL.test(s);
@@ -33,6 +36,8 @@ module.exports = {
checkUid, checkUid,
isUname, isUname,
checkUname, checkUname,
isRole,
checkRole,
isPassword, isPassword,
checkPassword, checkPassword,
isEmail, isEmail,
@@ -50,8 +55,6 @@ module.exports = {
}; };
/* /*
ID_RE = re.compile(r'[^\\/\s\u3000]([^\\/\n\r]*[^\\/\s\u3000])?') ID_RE = re.compile(r'[^\\/\s\u3000]([^\\/\n\r]*[^\\/\s\u3000])?')
ROLE_RE = re.compile(r'[_0-9A-Za-z]{1,256}')
def is_id(s): def is_id(s):
return bool(ID_RE.fullmatch(s)) return bool(ID_RE.fullmatch(s))
@@ -67,14 +70,6 @@ def check_node_name(s):
raise error.ValidationError('node_name') raise error.ValidationError('node_name')
def is_role(s):
return bool(ROLE_RE.fullmatch(s))
def check_role(s):
if not is_role(s):
raise error.ValidationError('role')
def is_intro(s): def is_intro(s):
return isinstance(s, str) and 0 < len(s.strip()) < 500 return isinstance(s, str) and 0 < len(s.strip()) < 500
@@ -93,15 +88,6 @@ def check_description(s):
raise error.ValidationError('description') raise error.ValidationError('description')
def is_bulletin(s):
return isinstance(s, str) and len(s) < 65536
def check_bulletin(s):
if not is_bulletin(s):
raise error.ValidationError('bulletin')
def is_lang(i): def is_lang(i):
return i in constant.language.LANG_TEXTS return i in constant.language.LANG_TEXTS
@@ -110,13 +96,4 @@ def check_lang(i):
if not is_lang(i): if not is_lang(i):
raise error.ValidationError('lang') raise error.ValidationError('lang')
def is_domain_invitation_code(s):
return bool(DOMAIN_INVITATION_CODE_RE.fullmatch(s))
def check_domain_invitation_code(s):
if not is_domain_invitation_code(s):
raise error.ValidationError('invitation_code')
*/ */
+2 -2
View File
@@ -2,8 +2,8 @@ const perm = require('../permission');
const BUILTIN_ROLES = [ const BUILTIN_ROLES = [
{ _id: 'guest', perm: perm.PERM_BASIC }, { _id: 'guest', perm: perm.PERM_BASIC },
{ _id: 'default', perm: perm.PERM_DEFAULT }, { _id: 'default', perm: perm.PERM_DEFAULT, count: 0 },
{ _id: 'admin', perm: perm.PERM_ADMIN }, { _id: 'admin', perm: perm.PERM_ADMIN, count: 0 },
]; ];
const CATEGORIES = { const CATEGORIES = {
动态规划: [ 动态规划: [
+1 -1
View File
@@ -41,7 +41,7 @@ function count(query) {
} }
function getMulti(query) { function getMulti(query) {
return coll.find(query).sort([{ updateAt: -1 }, { _id: -1 }]); return coll.find(query).sort('updateAt', -1);
} }
async function addReply(did, owner, content, ip) { async function addReply(did, owner, content, ip) {
+56 -25
View File
@@ -1,7 +1,6 @@
const system = require('./system'); const system = require('./system');
const { UserNotFoundError, UserAlreadyExistError } = require('../error'); const { UserNotFoundError, UserAlreadyExistError } = require('../error');
const pwhash = require('../lib/pwhash'); const pwhash = require('../lib/pwhash');
const validator = require('../lib/validator');
const db = require('../service/db'); const db = require('../service/db');
const coll = db.collection('user'); const coll = db.collection('user');
@@ -33,6 +32,7 @@ class USER {
return pwhash.check(password, this.salt, this.hash); return pwhash.check(password, this.salt, this.hash);
} }
} }
async function getById(_id) { async function getById(_id) {
const udoc = await coll.findOne({ _id }); const udoc = await coll.findOne({ _id });
if (!udoc) throw new UserNotFoundError(_id); if (!udoc) throw new UserNotFoundError(_id);
@@ -40,11 +40,13 @@ async function getById(_id) {
udoc.perm = role.perm; udoc.perm = role.perm;
return new USER(udoc); return new USER(udoc);
} }
async function getList(uids) { async function getList(uids) {
const r = {}; const r = {};
for (const uid of uids) r[uid] = await getById(uid); // eslint-disable-line no-await-in-loop for (const uid of uids) r[uid] = await getById(uid); // eslint-disable-line no-await-in-loop
return r; return r;
} }
async function getByUname(uname) { async function getByUname(uname) {
const unameLower = uname.trim().toLowerCase(); const unameLower = uname.trim().toLowerCase();
const udoc = await coll.findOne({ unameLower }); const udoc = await coll.findOne({ unameLower });
@@ -53,6 +55,7 @@ async function getByUname(uname) {
udoc.perm = role.perm; udoc.perm = role.perm;
return new USER(udoc); return new USER(udoc);
} }
async function getByEmail(mail, ignoreMissing = false) { async function getByEmail(mail, ignoreMissing = false) {
const mailLower = mail.trim().toLowerCase(); const mailLower = mail.trim().toLowerCase();
const udoc = await coll.findOne({ mailLower }); const udoc = await coll.findOne({ mailLower });
@@ -64,22 +67,23 @@ async function getByEmail(mail, ignoreMissing = false) {
udoc.perm = role.perm; udoc.perm = role.perm;
return new USER(udoc); return new USER(udoc);
} }
function setPassword(uid, password) { function setPassword(uid, password) {
validator.checkPassword(password);
const salt = pwhash.salt(); const salt = pwhash.salt();
return coll.findOneAndUpdate({ _id: uid }, { return coll.findOneAndUpdate({ _id: uid }, {
$set: { salt, hash: pwhash.hash(password, salt) }, $set: { salt, hash: pwhash.hash(password, salt) },
}); });
} }
function setById(uid, args) { function setById(uid, args) {
coll.findOneAndUpdate({ _id: uid }, { $set: args }); return coll.findOneAndUpdate({ _id: uid }, { $set: args });
} }
function setEmail(uid, mail) { function setEmail(uid, mail) {
validator.checkEmail(mail);
return setById(uid, { mail, mailLower: mail.trim().toLowerCase() }); return setById(uid, { mail, mailLower: mail.trim().toLowerCase() });
} }
async function changePassword(uid, currentPassword, newPassword) { async function changePassword(uid, currentPassword, newPassword) {
validator.checkPassword(newPassword);
const udoc = await getById(uid); const udoc = await getById(uid);
udoc.checkPassword(currentPassword); udoc.checkPassword(currentPassword);
const salt = pwhash.salt(); const salt = pwhash.salt();
@@ -89,59 +93,86 @@ async function changePassword(uid, currentPassword, newPassword) {
$set: { salt, hash: pwhash.hash(newPassword, salt) }, $set: { salt, hash: pwhash.hash(newPassword, salt) },
}); });
} }
async function inc(_id, field, n) { async function inc(_id, field, n) {
await coll.findOneAndUpdate({ _id }, { $inc: { [field]: n } }); await coll.findOneAndUpdate({ _id }, { $inc: { [field]: n } });
const udoc = await getById(_id); const udoc = await getById(_id);
return udoc; return udoc;
} }
async function create({ async function create({
uid, mail, uname, password, regip = '127.0.0.1', role = 'default', uid, mail, uname, password, regip = '127.0.0.1', role = 'default',
}) { }) {
validator.checkUname(uname);
validator.checkPassword(password);
validator.checkEmail(mail);
const salt = pwhash.salt(); const salt = pwhash.salt();
if (!uid) uid = system.inc('user'); if (!uid) uid = system.inc('user');
try { try {
await coll.insertOne({ await Promise.all([
_id: uid, coll.insertOne({
mail, _id: uid,
mailLower: mail.trim().toLowerCase(), mail,
uname, mailLower: mail.trim().toLowerCase(),
unameLower: uname.trim().toLowerCase(), uname,
password: pwhash.hash(password, salt), unameLower: uname.trim().toLowerCase(),
salt, password: pwhash.hash(password, salt),
regat: new Date(), salt,
regip, regat: new Date(),
loginat: new Date(), regip,
loginip: regip, loginat: new Date(),
role, loginip: regip,
gravatar: mail, role,
}); gravatar: mail,
}),
collRole.updateOne({ _id: role }, { $inc: { count: 1 } })
]);
} catch (e) { } catch (e) {
throw new UserAlreadyExistError([uid, uname, mail]); throw new UserAlreadyExistError([uid, uname, mail]);
} }
} }
function getMany(params) { function getMulti(params) {
return coll.find(params); return coll.find(params);
} }
async function setRole(uid, role) {
const udoc = await getById(uid);
return await Promise.all([
coll.findOneAndUpdate({ _id: uid }, { role }),
collRole.updateOne({ _id: udoc.role }, { $inc: { count: -1 } }),
collRole.updateOne({ _id: role }, { $inc: { count: 1 } }),
]);
}
function getRoles() { function getRoles() {
return collRole.find().toArray(); return collRole.find().toArray();
} }
function getRole(name) {
return collRole.findOne({ _id: name });
}
function addRole(name, perm) {
return collRole.insertOne({ _id: name, perm, count: 0 });
}
function deleteRoles(roles) {
return collRole.deleteMany({ _id: { $in: roles } });
}
module.exports = { module.exports = {
changePassword, changePassword,
create, create,
getByEmail, getByEmail,
getById, getById,
getByUname, getByUname,
getMany, getMulti,
inc, inc,
setById, setById,
setEmail, setEmail,
setPassword, setPassword,
setRole,
getRole,
getList, getList,
getRoles, getRoles,
addRole,
deleteRoles,
}; };
+1
View File
@@ -43,6 +43,7 @@ let options = {
SOLUTION_PER_PAGE: 20, SOLUTION_PER_PAGE: 20,
CONTEST_PER_PAGE: 20, CONTEST_PER_PAGE: 20,
TRAINING_PER_PAGE: 10, TRAINING_PER_PAGE: 10,
DISCUSSION_PER_PAGE: 50,
CONTESTS_ON_MAIN: 5, CONTESTS_ON_MAIN: 5,
TRAININGS_ON_MAIN: 5, TRAININGS_ON_MAIN: 5,
DISCUSSIONS_ON_MAIN: 20, DISCUSSIONS_ON_MAIN: 20,
+1 -1
View File
@@ -1,5 +1,5 @@
const Mongo = require('mongodb'); const Mongo = require('mongodb');
const bus = require('../service/bus'); const bus = require('./bus');
const options = require('../options'); const options = require('../options');
let mongourl = 'mongodb://'; let mongourl = 'mongodb://';
+29 -14
View File
@@ -113,6 +113,7 @@ class Handler {
back(body) { back(body) {
if (body) this.response.body = body; if (body) this.response.body = body;
else if (this.preferJson) this.response.body = {};
this.response.redirect = this.request.headers.referer || '/'; this.response.redirect = this.request.headers.referer || '/';
} }
@@ -165,17 +166,19 @@ class Handler {
} }
async renderBody() { async renderBody() {
if (!(this.response.body || this.response.template)) { if (!this.response.redirect) {
this.response.body = { error: new NotFoundError() }; if (!(this.response.body || this.response.template)) {
this.response.template = 'error.html'; this.response.body = { error: new NotFoundError() };
} this.response.template = 'error.html';
if (!this.preferJson) { }
if (this.response.body || this.response.template) { if (!this.preferJson) {
if (this.request.query.noTemplate || this.preferJson) return; if (this.response.body || this.response.template) {
const templateName = this.request.query.template || this.response.template; if (this.request.query.noTemplate || this.preferJson) return;
if (templateName) { const templateName = this.request.query.template || this.response.template;
this.response.body = this.response.body || {}; if (templateName) {
await this.render(templateName, this.response.body); this.response.body = this.response.body || {};
await this.render(templateName, this.response.body);
}
} }
} }
} }
@@ -192,7 +195,11 @@ class Handler {
this.ctx.response.body = this.response.body; this.ctx.response.body = this.response.body;
this.ctx.response.status = this.response.status || 200; this.ctx.response.status = this.response.status || 200;
} }
if (this.response.type) this.ctx.response.type = this.response.type; this.ctx.response.type = this.preferJson
? 'application/json'
: this.response.type
? this.response.type
: this.ctx.response.type;
} }
} }
@@ -233,7 +240,7 @@ class Handler {
console.error(error.message, error.params); console.error(error.message, error.params);
console.error(error.stack); console.error(error.stack);
this.response.template = error instanceof UserFacingError ? 'error.html' : 'bsod.html'; this.response.template = error instanceof UserFacingError ? 'error.html' : 'bsod.html';
this.response.body = { error }; this.response.body = { error: { message: error.message, params: error.params, stack: error.stack } };
await this.___cleanup().catch(() => { }); await this.___cleanup().catch(() => { });
} }
} }
@@ -247,6 +254,8 @@ function Route(route, RouteHandler) {
const method = ctx.method.toLowerCase(); const method = ctx.method.toLowerCase();
const args = { ...ctx.params, ...ctx.query, ...ctx.request.body }; const args = { ...ctx.params, ...ctx.query, ...ctx.request.body };
if (h.___prepare) await h.___prepare(args);
for (const l of check) { for (const l of check) {
if (args[l]) { if (args[l]) {
args[l] = new ObjectID(args[l]); args[l] = new ObjectID(args[l]);
@@ -256,11 +265,17 @@ function Route(route, RouteHandler) {
if (args.content) validator.checkContent(args.content); if (args.content) validator.checkContent(args.content);
if (args.title) validator.checkContent(args.title); if (args.title) validator.checkContent(args.title);
if (args.uid) args.uid = parseInt(validator.checkUid(args.uid)); if (args.uid) args.uid = parseInt(validator.checkUid(args.uid));
if (args.password) validator.checkPassword(args.password);
if (args.mail) validator.checkEmail(args.mail);
if (args.uname) validator.checkUname(args.uname);
if (args.page) args.page = parseInt(args.page); if (args.page) args.page = parseInt(args.page);
if (args.duration) args.duration = parseFloat(args.duration); if (args.duration) args.duration = parseFloat(args.duration);
if (args.pids) args.pids = args.pids.split(',').map((i) => i.trim()); if (args.pids) args.pids = args.pids.split(',').map((i) => i.trim());
if (args.role) validator.checkRole(args.role);
if (args.roles) {
for (const i of args.roles) validator.checkRole(i);
}
if (h.___prepare) await h.___prepare(args);
if (h.__prepare) await h.__prepare(args); if (h.__prepare) await h.__prepare(args);
if (h._prepare) await h._prepare(args); if (h._prepare) await h._prepare(args);
if (h.prepare) await h.prepare(args); if (h.prepare) await h.prepare(args);
+1 -1
View File
@@ -386,7 +386,7 @@ Solve: 解决
Time: 时间 Time: 时间
required: 必填 required: 必填
Name: 名称 Name: 名称
Will be used as the domain icon.: 将被用作域图标。 Will be used as the system icon.: 将被用作系统图标。
My Role: 我的角色 My Role: 我的角色
What's domain?: 什么是域? What's domain?: 什么是域?
Visit: 查看 Visit: 查看
+1 -1
View File
@@ -375,7 +375,7 @@ Solve: 解決
Time: 時間 Time: 時間
required: 必填 required: 必填
Name: 名稱 Name: 名稱
Will be used as the domain icon.: 將被用作域圖示。 Will be used as the system icon.: 將被用作圖示。
My Role: 我的角色 My Role: 我的角色
What's domain?: 什麼是域? What's domain?: 什麼是域?
Visit: 檢視 Visit: 檢視
+2 -3
View File
@@ -1,7 +1,6 @@
{% macro render_item(icon_name, page_name, label=none) %} {% macro render_item(icon_name, page_name, target_url, label=none) %}
<li class="menu__item" id="menu-item-{{ page_name }}"> <li class="menu__item" id="menu-item-{{ page_name }}">
{% set target_url = reverse_url(page_name, args) %} <a href="{{ target_url }}" class="menu__link{% if handler.request.path == target_url %} active{% endif %}">
<a href="{{ target_url }}" class="menu__link{% if handler.request.path_qs == target_url %} active{% endif %}">
{% if icon_name %} {% if icon_name %}
<span class="icon icon-{{ icon_name }}"></span> <span class="icon icon-{{ icon_name }}"></span>
{% endif %} {% endif %}
+14 -18
View File
@@ -7,10 +7,10 @@
<div class="section__body"> <div class="section__body">
<ul class="supplementary list"> <ul class="supplementary list">
<li> <li>
<a class="discussion-node-tag" href="{{ vj4.handler.discussion.node_url(handler, 'discussion_node', vj4.model.adaptor.discussion.node_id(ddoc)) }}"> <a class="discussion-node-tag" href="/discuss/{{ ddoc.parentType }}/{{ ddoc.parentId }}">
{% if ddoc['parent_doc_type'] == vj4.model.document.TYPE_DISCUSSION_NODE %} {% if ddoc.parentType == 'node' %}
<span class="v-center icon icon-tag"></span> <span class="v-center icon icon-tag"></span>
{% elif ddoc['parent_doc_type'] == vj4.model.document.TYPE_CONTEST %} {% elif ddoc.parentType == 'contest' %}
<span class="v-center icon icon-award"></span> <span class="v-center icon icon-award"></span>
{% else %} {% else %}
<span class="v-center icon icon-flag"></span> <span class="v-center icon icon-flag"></span>
@@ -19,19 +19,19 @@
</a> </a>
</li> </li>
<li> <li>
{{ user.render_inline(udict[ddoc['owner']]) }} {{ user.render_inline(udict[ddoc.owner]) }}
@ @
{{ datetime_span(ddoc['_id'].generationTime) }} {{ datetime_span(ddoc['_id'].generationTime)|safe }}
</li> </li>
</ul> </ul>
<div class="typo topic__content" data-emoji-enabled data-raw-url="{{ reverse_url('discussion_detail_raw', did=ddoc['_id']) }}"> <div class="typo topic__content" data-emoji-enabled data-raw-url="/discuss/{{ ddoc._id }}/raw">
{{ ddoc['content']|markdown }} {{ ddoc['content']|markdown|safe }}
</div> </div>
</div> </div>
<ul class="section__footer supplementary dot list"> <ul class="section__footer supplementary dot list">
{% if handler.own(ddoc, perm.PERM_EDIT_DISCUSSION_SELF) or handler.hasPerm(perm.PERM_EDIT_DISCUSSION) %} {% if ddoc.owner == handler.user._id or handler.hasPerm(perm.PERM_EDIT_DISCUSSION) %}
<li> <li>
<a href="{{ reverse_url('discussion_edit', did=ddoc['doc_id']) }}"><span class="icon icon-edit"></span> {{ _('Edit') }}</a> <a href="/discuss/{{ ddoc._id }}/edit"><span class="icon icon-edit"></span> {{ _('Edit') }}</a>
</li> </li>
{% endif %} {% endif %}
<li> <li>
@@ -48,7 +48,7 @@
</form></li> </form></li>
{% endif %} {% endif %}
<li> <li>
<a href="{{ reverse_url('about') }}#contact"><span class="icon icon-warning"></span> {{ _('Report') }}</a> <a href="/wiki/about#contact"><span class="icon icon-warning"></span> {{ _('Report') }}</a>
</li> </li>
</ul> </ul>
</div> </div>
@@ -64,15 +64,11 @@
comment_ref = 'drid', comment_ref = 'drid',
reply_ref = 'drrid', reply_ref = 'drrid',
comment_post_perm = perm.PERM_REPLY_DISCUSSION, comment_post_perm = perm.PERM_REPLY_DISCUSSION,
comment_edit_perm = perm.PERM_NONE if handler.own(ddoc, perm.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION) else perm.PERM_EDIT_DISCUSSION_REPLY, comment_edit_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
comment_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF, comment_delete_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
comment_delete_perm = perm.PERM_NONE if handler.own(ddoc, perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION) else perm.PERM_DELETE_DISCUSSION_REPLY,
comment_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF,
reply_post_perm = perm.PERM_REPLY_DISCUSSION, reply_post_perm = perm.PERM_REPLY_DISCUSSION,
reply_edit_perm = perm.PERM_NONE if handler.own(ddoc, perm.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION) else perm.PERM_EDIT_DISCUSSION_REPLY, reply_edit_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
reply_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF, reply_delete_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_delete_perm = perm.PERM_NONE if handler.own(ddoc, perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION) else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF
) }} ) }}
{{ paginator.render(page, pcount) }} {{ paginator.render(page, pcount) }}
{% if drcount == 0 %} {% if drcount == 0 %}
+1 -1
View File
@@ -11,7 +11,7 @@
<button name="operation" value="update" type="submit" class="rounded primary button"> <button name="operation" value="update" type="submit" class="rounded primary button">
{{ _('Update') }} (Ctrl+Enter) {{ _('Update') }} (Ctrl+Enter)
</button> </button>
{% if handler.own(ddoc, perm.PERM_DELETE_DISCUSSION_SELF) or handler.hasPerm(perm.PERM_DELETE_DISCUSSION) %} {% if ddoc.owner == handler.user._id or handler.hasPerm(perm.PERM_DELETE_DISCUSSION) %}
<button name="operation" value="delete" type="submit" class="rounded button"> <button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }} {{ _('Delete') }}
</button> </button>
+8 -9
View File
@@ -7,17 +7,17 @@
</div> </div>
</div> </div>
<div class="medium-3 columns"> <div class="medium-3 columns">
{% if vnode['doc_type'] == vj4.model.document.TYPE_PROBLEM %} {% if vnode.parentType == 'problem' %}
{% with pdoc=vnode, owner_udoc=udict[vnode['owner']] %} {% set pdoc = vnode %}
{% set owner_udoc = udict[vnode.owner] %}
{% include "partials/problem_sidebar.html" %} {% include "partials/problem_sidebar.html" %}
{% endwith %} {% elif vnode.parentType == 'contest' %}
{% elif vnode['doc_type'] == vj4.model.document.TYPE_CONTEST %} {% set tdoc = vnode %}
{% with tdoc=vnode, owner_udoc=udict[vnode['owner']] %} {% set owner_udoc = udict[vnode.owner] %}
{% include "partials/contest_sidebar.html" %} {% include "partials/contest_sidebar.html" %}
{% endwith %} {% elif vnode.parentType == 'node' %}
{% elif vnode['doc_type'] == vj4.model.document.TYPE_DISCUSSION_NODE %}
<div class="section side"> <div class="section side">
{% if vnode['pic'] %}<div class="discussion-node__bg {{ vnode['pic'] }}"></div>{% endif %} {% if vnode.pic %}<div class="discussion-node__bg {{ vnode.pic }}"></div>{% endif %}
<div class="section__header"> <div class="section__header">
<h1 class="section__title">{{ vnode['title'] or _('Create Discussion') }}</h1> <h1 class="section__title">{{ vnode['title'] or _('Create Discussion') }}</h1>
</div> </div>
@@ -38,7 +38,6 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% include 'discussion_nodes_widget.html' %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
-17
View File
@@ -1,17 +0,0 @@
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Discussion Nodes') }}</h1>
</div>
<div class="section__body"><ul class="group-list">
{% for category, nodes in discussionNodes.items() %}
<li class="group-list__item">
<h2 class="section__title">{{ category }}</h2>
<ol class="chip-list">
{% for node in nodes %}
<li class="chip-list__item"><a class="typo-a" href="{{ reverse_url('discussion_node', doc_id=node['name']) }}">{{ node['name'] }}</a></li>
{% endfor %}
</ol>
</li>
{% endfor %}
</ul></div>
</div>
-26
View File
@@ -1,26 +0,0 @@
{% extends "layout/basic.html" %}
{% block content %}
<div class="domain_join__container">
<div class="row columns">
<div class="section">
<div class="section__header">
<h1 class="section__title">
{{ _('Join {0}').format(handler.domain['name']) }}
</h1>
</div>
<div class="section__body typo">
<p>{{ _('By clicking the button, you will become a member of the domain {0}.').format(handler.domain['name']) }}</p>
</div>
<div class="section__body typo">
<form method="post">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
{% if join_settings['method'] == vj4.constant.domain.JOIN_METHOD_CODE %}
{{ form.form_text(columns=None, label='Invitation Code', name='code', required=true, help_text='You need to enter the invitation code to join the domain.', value=code, autofocus=True) }}
{% endif %}
<button type="submit" class="primary rounded button">{{ _('Join') }}</button>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
+6 -5
View File
@@ -1,10 +1,11 @@
{% set page_name = "domain_manage_dashboard" %}
{% import "components/user.html" as user %} {% import "components/user.html" as user %}
{% extends "domain_base.html" %} {% extends "manage_base.html" %}
{% block domain_content %} {% block domain_content %}
{% if handler.domain['bulletin'] %} {% if system.bio %}
<div class="section"> <div class="section">
<div class="section__body typo"> <div class="section__body typo">
{{ handler.domain['bulletin']|markdown }} {{ system.bio|markdown|safe }}
</div> </div>
</div> </div>
{% endif %} {% endif %}
@@ -14,8 +15,8 @@
</div> </div>
<div class="section__body typo"> <div class="section__body typo">
<dl class="large horizontal"> <dl class="large horizontal">
<dt>{{ _('Gravatar') }}</dt><dd><img src="{{ handler.domain['gravatar']|gravatar_url }}" width="32" height="32"></dd> <dt>{{ _('Gravatar') }}</dt><dd><img src="{{ system.gravatar|gravatar_url }}" width="32" height="32"></dd>
<dt>{{ _('Name') }}</dt><dd>{{ handler.domain['name'] }}</dd> <dt>{{ _('Name') }}</dt><dd>{{ system.uname }}</dd>
</dl> </dl>
</div> </div>
</div> </div>
-22
View File
@@ -1,22 +0,0 @@
{% extends "domain_base.html" %}
{% block domain_content %}
<div class="section">
<div class="section__header">
<h1 class="section__title">{{ _('Initialize') }}</h1>
<div class="section__tools">
<form method="post">
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="rounded primary button">
<span class="icon icon-add"></span> {{ _('Initialize') }}
</button>
</div></div>
</form>
</div>
</div>
<div class="section__body">
</div>
</div>
{% include 'discussion_nodes_widget.html' %}
{% endblock %}
+24 -4
View File
@@ -1,11 +1,31 @@
{% extends "domain_base.html" %} {% set page_name = "domain_manage_edit" %}
{% import "components/form.html" as form with context %}
{% extends "manage_base.html" %}
{% block domain_content %} {% block domain_content %}
<div class="section"> <div class="section">
<div class="section__body"> <div class="section__body">
<form method="post"> <form method="post">
{% with ddoc=handler.domain %} {{ form.form_text({
{% include "partials/domain_edit_form.html" %} label:'Name',
{% endwith %} name:'uname',
value:system.uname,
autofocus:true,
required:true
}) }}
{{ form.form_text({
label:'Gravatar Email',
help_text:'Will be used as the system icon.',
name:'gravatar',
value:system.gravatar
}) }}
{{ form.form_textarea({
columns:12,
label:'Bulletin',
name:'bio',
value:system.bio,
markdown:true,
required:false
}) }}
<div class="row"><div class="columns"> <div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}"> <input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="rounded primary button"> <button type="submit" class="rounded primary button">
+1 -1
View File
@@ -1,4 +1,4 @@
{% extends "domain_base.html" %} {% extends "manage_base.html" %}
{% block domain_content %} {% block domain_content %}
<form method="post"> <form method="post">
<div class="section"> <div class="section">
+20 -27
View File
@@ -1,4 +1,5 @@
{% extends "domain_base.html" %} {% set page_name = "domain_manage_role" %}
{% extends "manage_base.html" %}
{% block domain_content %} {% block domain_content %}
<div style="display: none" class="dialog__body--create-role"> <div style="display: none" class="dialog__body--create-role">
<div> <div>
@@ -42,12 +43,26 @@
</label> </label>
</th> </th>
<th class="col--id">{{ _('Role') }}</th> <th class="col--id">{{ _('Role') }}</th>
<th class="col--description">{{ _('Description') }}</th>
<th class="col--users">{{ _('Users') }}</th> <th class="col--users">{{ _('Users') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for role, rd in vj4.model.builtin.BUILTIN_ROLE_DESCRIPTORS.items() %} {% for role in roles %}
{% if role._id not in ['default', 'guest', 'admin'] %}
<tr data-role="{{ role._id }}">
<td class="col--checkbox">
<label class="compact checkbox">
<input type="checkbox" data-checkbox-group="role" data-checkbox-range>
</label>
</td>
<td class="col--id">
{{ _('User-defined role') }}: {{ role._id }}
</td>
<td class="col--users">
{{ role.count }}
</td>
</tr>
{% else %}
<tr> <tr>
<td class="col--checkbox"> <td class="col--checkbox">
<label class="compact checkbox"> <label class="compact checkbox">
@@ -55,32 +70,10 @@
</label> </label>
</td> </td>
<td class="col--id"> <td class="col--id">
{{ role }} {{ _('Built-in') }}: {{ role._id }}
</td>
<td class="col--description">
{{ _('Built-in') }}: {{ _(rd.description) }}
</td> </td>
<td class="col--users"> <td class="col--users">
{{ rucounts.get(role, '--') }} {{ role.count|default('--') }}
</td>
</tr>
{% endfor %}
{% for role in roles %}
{% if role not in vj4.model.builtin.BUILTIN_ROLE_DESCRIPTORS %}
<tr data-role="{{ role }}">
<td class="col--checkbox">
<label class="compact checkbox">
<input type="checkbox" data-checkbox-group="role" data-checkbox-range>
</label>
</td>
<td class="col--id">
{{ role }}
</td>
<td class="col--description">
{{ _('User-defined role') }}
</td>
<td class="col--users">
{{ rucounts[role] }}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
+1 -1
View File
@@ -1,4 +1,4 @@
{% extends "domain_base.html" %} {% extends "manage_base.html" %}
{% block domain_content %} {% block domain_content %}
<div style="display: none" class="dialog__body--add-user"> <div style="display: none" class="dialog__body--add-user">
<div> <div>
-36
View File
@@ -1,36 +0,0 @@
{% extends "layout/home_base.html" %}
{% block home_content %}
<div data-heading-extract-to="#menu-item-home_domain">
<div class="section">
<div class="section__header">
<h1 class="section__title" id="create" data-heading>{{ _('Create Domain') }}</h1>
</div>
<div class="section__body">
<blockquote class="note typo">
<p>{{ _('A domain ID cannot be changed after creation. It is supposed to be:') }}</p>
<ul>
<li>{{ _('Unique') }}</li>
<li>{{ _('At least 4 characters') }}</li>
<li>{{ _('Not wrapped with space') }}</li>
<li>{{ _('Not started with a number') }}</li>
<li>{{ _('Only A-Z, a-z, 0-9 and _ are accepted') }}</li>
</ul>
</blockquote>
<form method="post">
{% with ddoc={} %}
{% include "partials/domain_edit_form.html" %}
{% endwith %}
<div class="row"><div class="columns">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="rounded primary button">
{{ _('Create') }}
</button>
<button type="button" class="rounded button" onclick="window.history.go(-1)">
{{ _('Cancel') }}
</button>
</div></div>
</form>
</div>
</div>
</div>
{% endblock %}
-1
View File
@@ -37,7 +37,6 @@
<!--[if lte IE 8]> <!--[if lte IE 8]>
<script type="text/javascript" src="{{ static_url('shim.js') }}"></script> <script type="text/javascript" src="{{ static_url('shim.js') }}"></script>
<![endif]--> <![endif]-->
<script type="text/javascript" src="{{ static_url('manifest.js') }}"></script>
<script type="text/javascript" src="{{ static_url('locale/{0}.js'.format(handler.user.lang)) }}"></script> <script type="text/javascript" src="{{ static_url('locale/{0}.js'.format(handler.user.lang)) }}"></script>
<script type="text/javascript" src="{{ static_url('vj4.js') }}"></script> <script type="text/javascript" src="{{ static_url('vj4.js') }}"></script>
</body> </body>
@@ -12,27 +12,20 @@
<span class="icon icon-info"></span> {{ _('Properties') }} <span class="icon icon-info"></span> {{ _('Properties') }}
</div> </div>
<ol class="menu collapsed"> <ol class="menu collapsed">
{{ sidemenu.render_item(null, 'domain_manage_dashboard') }} {{ sidemenu.render_item(null, 'domain_manage_dashboard', '/manage/dashboard') }}
{% if handler.hasPerm(perm.PERM_EDIT_DESCRIPTION) %} {{ sidemenu.render_item(null, 'domain_manage_edit', '/manage/edit') }}
{{ sidemenu.render_item(null, 'domain_manage_edit') }}
{{ sidemenu.render_item(null, 'domain_manage_join_applications') }}
{{ sidemenu.render_item(null, 'domain_manage_discussion') }}
{% endif %}
<!-- Ranking Settings -->
</ol> </ol>
</li> </li>
{% if handler.hasPerm(perm.PERM_EDIT_PERM) %}
<li class="menu__item"> <li class="menu__item">
<div class="menu__link expandable"> <div class="menu__link expandable">
<span class="icon icon-user"></span> {{ _('Access Control') }} <span class="icon icon-user"></span> {{ _('Access Control') }}
</div> </div>
<ol class="menu collapsed"> <ol class="menu collapsed">
{{ sidemenu.render_item(null, 'domain_manage_role') }} {{ sidemenu.render_item(null, 'domain_manage_role', '/manage/role') }}
{{ sidemenu.render_item(null, 'domain_manage_user') }} {{ sidemenu.render_item(null, 'domain_manage_user', '/manage/user') }}
{{ sidemenu.render_item(null, 'domain_manage_permission') }} {{ sidemenu.render_item(null, 'domain_manage_permission', '/manage/permission') }}
</ol> </ol>
</li> </li>
{% endif %}
</ol> </ol>
</div> </div>
</div></div> </div></div>
+1 -9
View File
@@ -1,9 +1 @@
{% import "components/form.html" as form with context %}
{% if page_name == 'domain_manage_edit' %}
{{ form.form_text(label='ID', name='id', value=ddoc['_id'], disabled=true) }}
{% elif page_name == 'home_domain_create' %}
{{ form.form_text(label='ID', name='id', autofocus=true, required=true) }}
{% endif %}
{{ form.form_text(label='Name', name='name', value=ddoc['name']|default(''), autofocus=(page_name == 'domain_manage_edit'), required=true) }}
{{ form.form_text(label='Gravatar Email', help_text='Will be used as the domain icon.', name='gravatar', value=ddoc['gravatar']|default('')) }}
{{ form.form_textarea(columns=12, label='Bulletin', name='bulletin', value=ddoc['bulletin']|default(''), markdown=true, required=false) }}
+2 -2
View File
@@ -18,13 +18,13 @@
{{ nav_item('/t', 'training_main', 'training') }} {{ nav_item('/t', 'training_main', 'training') }}
{% endif %} {% endif %}
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %} {% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
{{ nav_item('/d', 'discussion_main', 'discussion') }} {{ nav_item('/discuss', 'discussion_main', 'discussion') }}
{% endif %} {% endif %}
{% if handler.hasPerm(perm.PERM_VIEW_CONTEST) %} {% if handler.hasPerm(perm.PERM_VIEW_CONTEST) %}
{{ nav_item('/c', 'contest_main', 'contest') }} {{ nav_item('/c', 'contest_main', 'contest') }}
{% endif %} {% endif %}
{% if handler.hasPerm(perm.PERM_EDIT_DESCRIPTION) or handler.hasPerm(perm.PERM_EDIT_PERM) %} {% if handler.hasPerm(perm.PERM_EDIT_DESCRIPTION) or handler.hasPerm(perm.PERM_EDIT_PERM) %}
{{ nav_item('/d', 'domain_manage', 'domain_manage') }} {{ nav_item('/manage', 'domain_manage', 'domain_manage') }}
{% endif %} {% endif %}
</ol> </ol>
<ol class="nav__list nav__list--secondary clearfix"> <ol class="nav__list nav__list--secondary clearfix">
@@ -1,19 +0,0 @@
import { NamedPage } from 'vj/misc/PageLoader';
import * as domainEnum from 'vj/constant/domain';
const page = new NamedPage('domain_manage_join_applications', () => {
const $role = $('[name="role"]');
const $expire = $('[name="expire"]');
const $code = $('[name="invitation_code"]');
function updateFormState() {
const method = parseInt($('[name="method"]:checked').val(), 10);
$role.prop('disabled', method === domainEnum.JOIN_METHOD_NONE).trigger('vjFormDisableUpdate');
$expire.prop('disabled', method === domainEnum.JOIN_METHOD_NONE).trigger('vjFormDisableUpdate');
$code.prop('disabled', method !== domainEnum.JOIN_METHOD_CODE).trigger('vjFormDisableUpdate');
}
updateFormState();
$('[name="method"]').change(() => updateFormState());
});
export default page;
+1 -1
View File
@@ -73,7 +73,7 @@ const page = new NamedPage('domain_manage_role', () => {
try { try {
await request.post('', { await request.post('', {
operation: 'delete', operation: 'delete',
role: selectedRoles, roles: selectedRoles,
}); });
Notification.success(i18n('Selected roles have been deleted.')); Notification.success(i18n('Selected roles have been deleted.'));
await delay(2000); await delay(2000);
-3
View File
@@ -2,8 +2,5 @@
.col--checkbox .col--checkbox
width: 60px width: 60px
.col--id
width: 140px
.col--users .col--users
width: 100px width: 100px