Allowing editors revision access.
This commit is contained in:
parent
99c10cf394
commit
145ee198ff
|
@ -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"
|
||||
>
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue