core: fix share

This commit is contained in:
undefined committed 2021-10-29 20:33:07 +08:00
1 parent 5c3b13be82
commit c116d6a212
4 files changed
+6 -8

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "3.1.17", "version": "3.1.18",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/loader", "main": "src/loader",
"module": "src/loader", "module": "src/loader",
+4
View File
@@ -187,6 +187,8 @@ export class ProblemMainHandler extends ProblemHandler {
@param('pids', Types.NumericArray) @param('pids', Types.NumericArray)
@param('target', Types.String) @param('target', Types.String)
async postCopy(domainId: string, pids: number[], target: string) { async postCopy(domainId: string, pids: number[], target: string) {
const t = `,${this.domain.share || ''},`;
if (t !== ',*,' && !t.includes(`,${target},`)) throw new PermissionError(target);
const ddoc = await domain.get(target); const ddoc = await domain.get(target);
if (!ddoc) throw new NotFoundError(target); if (!ddoc) throw new NotFoundError(target);
const dudoc = await user.getById(target, this.user._id); const dudoc = await user.getById(target, this.user._id);
@@ -346,6 +348,8 @@ export class ProblemDetailHandler extends ProblemHandler {
@param('target', Types.String) @param('target', Types.String)
async postCopy(domainId: string, target: string) { async postCopy(domainId: string, target: string) {
const t = `,${this.domain.share || ''},`;
if (t !== ',*,' && !t.includes(`,${target},`)) throw new PermissionError(target);
const ddoc = await domain.get(target); const ddoc = await domain.get(target);
if (!ddoc) throw new NotFoundError(target); if (!ddoc) throw new NotFoundError(target);
const dudoc = await user.getById(target, this.user._id); const dudoc = await user.getById(target, this.user._id);
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.26.9", "version": "4.26.10",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",
@@ -8,10 +8,8 @@
{% else %} {% else %}
<table class="data-table"> <table class="data-table">
<colgroup> <colgroup>
{% if handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<col class="col--checkbox display-mode-hide"> <col class="col--checkbox display-mode-hide">
<col class="col--pid display-mode-hide"> <col class="col--pid display-mode-hide">
{% endif %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status edit-mode-hide"> <col class="col--status edit-mode-hide">
{% endif %} {% endif %}
@@ -22,14 +20,12 @@
</colgroup> </colgroup>
<thead> <thead>
<tr> <tr>
{% if handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<th class="col--checkbox display-mode-hide"> <th class="col--checkbox display-mode-hide">
<label class="compact checkbox"> <label class="compact checkbox">
<input type="checkbox" name="select_all" data-checkbox-toggle="problem"> <input type="checkbox" name="select_all" data-checkbox-toggle="problem">
</label> </label>
</th> </th>
<th class="col--pid display-mode-hide">{{ _('ID') }}</th> <th class="col--pid display-mode-hide">{{ _('ID') }}</th>
{% endif %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border edit-mode-hide">{{ _('Status') }}</th> <th class="col--status record-status--border edit-mode-hide">{{ _('Status') }}</th>
{% endif %} {% endif %}
@@ -43,14 +39,12 @@
{%- for pdoc in pdocs -%} {%- for pdoc in pdocs -%}
{% set psdoc = psdict[pdoc['docId']] %} {% set psdoc = psdict[pdoc['docId']] %}
<tr data-pid="{{ pdoc.docId }}"> <tr data-pid="{{ pdoc.docId }}">
{% if handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<td class="col--checkbox display-mode-hide"> <td class="col--checkbox display-mode-hide">
<label class="compact checkbox"> <label class="compact checkbox">
<input type="checkbox" data-checkbox-group="problem" data-checkbox-range> <input type="checkbox" data-checkbox-group="problem" data-checkbox-range>
</label> </label>
</td> </td>
<td class="col--pid display-mode-hide">{{ pdoc.docId }}</td> <td class="col--pid display-mode-hide">{{ pdoc.docId }}</td>
{% endif %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdoc['rid'] %} {% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid', class="edit-mode-hide") }} {{ record.render_status_td(psdoc, rid_key='rid', class="edit-mode-hide") }}