Allowing editors revision access.

This commit is contained in:
DebaucheryLibrarian 2024-10-06 02:57:31 +02:00
parent 99c10cf394
commit 145ee198ff
2 changed files with 3 additions and 5 deletions

View File

@ -190,7 +190,7 @@
</li>
<li
v-if="user?.role === 'admin'"
v-if="user?.role === 'admin' || user?.role === 'editor'"
v-close-popper
class="menu-item"
>

View File

@ -640,12 +640,12 @@ export async function fetchSceneRevisions(revisionId, filters = {}, reqUser) {
.leftJoin('users', 'users.id', 'scenes_revisions.user_id')
.leftJoin('users as reviewers', 'reviewers.id', 'scenes_revisions.reviewed_by')
.modify((builder) => {
if (reqUser?.role !== 'admin' && !filters.userId && !filters.sceneId) {
if (!['admin', 'editor'].includes(reqUser?.role) && !filters.userId && !filters.sceneId) {
builder.where('user_id', reqUser.id);
}
if (filters.userId) {
if (reqUser?.role !== 'admin' && filters.userId !== reqUser.id) {
if (!['admin', 'editor'].includes(reqUser?.role) && filters.userId !== reqUser.id) {
throw new HttpError('You are not permitted to view revisions from other users.', 403);
}
@ -661,8 +661,6 @@ export async function fetchSceneRevisions(revisionId, filters = {}, reqUser) {
builder.where('scenes_revisions.scene_id', filters.sceneId);
}
console.log(filters);
if (filters.isFinalized === false) {
builder.whereNull('approved');
}