mirror of
https://github.com/umami-software/umami.git
synced 2026-02-21 13:05:36 +01:00
implemented the user view type and website sharing
This commit is contained in:
parent
7a3443cd06
commit
66e67c7a3b
19 changed files with 260 additions and 68 deletions
|
|
@ -9,6 +9,7 @@ export default async (req, res) => {
|
|||
await useAuth(req, res);
|
||||
|
||||
const { id: websiteUuid } = req.query;
|
||||
const { accountUuid, isViewer } = req.auth;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (!(await allowQuery(req, TYPE_WEBSITE))) {
|
||||
|
|
@ -21,12 +22,11 @@ export default async (req, res) => {
|
|||
}
|
||||
|
||||
if (req.method === 'POST') {
|
||||
if (!(await allowQuery(req, TYPE_WEBSITE, false))) {
|
||||
if (!(await allowQuery(req, TYPE_WEBSITE, false)) || isViewer) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const { name, domain, owner, enableShareUrl, shareId } = req.body;
|
||||
const { accountUuid } = req.auth;
|
||||
|
||||
let account;
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ export default async (req, res) => {
|
|||
}
|
||||
|
||||
if (req.method === 'DELETE') {
|
||||
if (!(await allowQuery(req, TYPE_WEBSITE, false))) {
|
||||
if (!(await allowQuery(req, TYPE_WEBSITE, false)) || isViewer) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ export default async (req, res) => {
|
|||
await useAuth(req, res);
|
||||
|
||||
const { id: websiteId } = req.query;
|
||||
const { isViewer } = req.auth;
|
||||
|
||||
if (req.method === 'POST') {
|
||||
if (!(await allowQuery(req, TYPE_WEBSITE, false))) {
|
||||
if (!(await allowQuery(req, TYPE_WEBSITE, false)) || isViewer) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue