mirror of
https://github.com/umami-software/umami.git
synced 2026-02-21 04:55:36 +01:00
add customUserId to add website of any user by admin
This commit is contained in:
parent
77fd98387c
commit
6d93b57d25
1 changed files with 6 additions and 4 deletions
|
|
@ -15,6 +15,7 @@ export interface WebsitesRequestBody {
|
||||||
name: string;
|
name: string;
|
||||||
domain: string;
|
domain: string;
|
||||||
shareId: string;
|
shareId: string;
|
||||||
|
customUserId:string
|
||||||
}
|
}
|
||||||
|
|
||||||
const schema = {
|
const schema = {
|
||||||
|
|
@ -25,6 +26,7 @@ const schema = {
|
||||||
name: yup.string().max(100).required(),
|
name: yup.string().max(100).required(),
|
||||||
domain: yup.string().max(500).required(),
|
domain: yup.string().max(500).required(),
|
||||||
shareId: yup.string().max(50).nullable(),
|
shareId: yup.string().max(50).nullable(),
|
||||||
|
customUserId: yup.string().max(50).nullable(),
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -53,7 +55,7 @@ export default async (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
const { name, domain, shareId } = req.body;
|
const { name, domain, shareId ,customUserId} = req.body;
|
||||||
|
|
||||||
if (!(await canCreateWebsite(req.auth))) {
|
if (!(await canCreateWebsite(req.auth))) {
|
||||||
return unauthorized(res);
|
return unauthorized(res);
|
||||||
|
|
@ -65,11 +67,11 @@ export default async (
|
||||||
domain,
|
domain,
|
||||||
shareId,
|
shareId,
|
||||||
};
|
};
|
||||||
|
|
||||||
data.userId = userId;
|
data.userId = userId;
|
||||||
|
if(customUserId){
|
||||||
|
data.userId = customUserId;
|
||||||
|
}
|
||||||
const website = await createWebsite(data);
|
const website = await createWebsite(data);
|
||||||
|
|
||||||
return ok(res, website);
|
return ok(res, website);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue