-
lock
lock_open
-
+
favorite
diff --git a/frontend/src/component/photo/mosaic.vue b/frontend/src/component/photo/mosaic.vue
index 7d4db33f5..8e40dff07 100644
--- a/frontend/src/component/photo/mosaic.vue
+++ b/frontend/src/component/photo/mosaic.vue
@@ -82,7 +82,7 @@
play_arrow
-
lock
@@ -103,9 +103,9 @@
icon flat small absolute
class="input-favorite"
@touchstart.stop.prevent="input.touchStart($event, index)"
- @touchend.stop.prevent="toggleLike($event, index)"
+ @touchend.stop.prevent="hasPermission(aclResources.ResourcePhotos, aclActions.ActionLike) && toggleLike($event, index)"
@touchmove.stop.prevent
- @click.stop.prevent="toggleLike($event, index)">
+ @click.stop.prevent="hasPermission(aclResources.ResourcePhotos, aclActions.ActionLike) && toggleLike($event, index)">
favorite
favorite_border
@@ -220,7 +220,7 @@ export default {
},
selectRange(index) {
this.$clipboard.addRange(index, this.photos);
- }
+ },
},
};
diff --git a/frontend/src/component/photo/toolbar.vue b/frontend/src/component/photo/toolbar.vue
index 9059c21cb..a1f814c26 100644
--- a/frontend/src/component/photo/toolbar.vue
+++ b/frontend/src/component/photo/toolbar.vue
@@ -28,7 +28,7 @@
view_column
-
cloud_upload
diff --git a/frontend/src/component/photo/viewer.vue b/frontend/src/component/photo/viewer.vue
index d223f7cea..185c49bdb 100644
--- a/frontend/src/component/photo/viewer.vue
+++ b/frontend/src/component/photo/viewer.vue
@@ -33,7 +33,7 @@
radio_button_off
- |
refresh
-
cloud_upload
diff --git a/frontend/src/routes.js b/frontend/src/routes.js
index f344daaa7..c19a69d8d 100644
--- a/frontend/src/routes.js
+++ b/frontend/src/routes.js
@@ -53,10 +53,17 @@ const c = window.__CONFIG__;
const appName = c.name;
const siteTitle = c.siteTitle ? c.siteTitle : c.name;
-const acl = () => new Acl(window.__CONFIG__.acl);
const aclActions = Constants.actions;
const aclResources = Constants.resources;
+const hasPermission = (resource, action) => {
+ if (config.values.public) return true;
+ // const acl = new Acl(window.__CONFIG__.acl);
+ const acl = new Acl(config.values.acl);
+ const userrole = session.getUser().getRole();
+ return acl.accessAllowed(userrole, resource, action);
+};
+
export default [
{
name: "home",
@@ -200,8 +207,7 @@ export default [
meta: { title: $gettext("Review"), auth: true },
props: { staticFilter: { review: true } },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceReview, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceReview, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -215,8 +221,7 @@ export default [
meta: { title: $gettext("Private"), auth: true },
props: { staticFilter: { private: true } },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourcePrivate, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourcePrivate, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -230,8 +235,7 @@ export default [
meta: { title: $gettext("Archive"), auth: true },
props: { staticFilter: { archived: true } },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceArchive, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceArchive, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -269,8 +273,7 @@ export default [
component: Files,
meta: { title: $gettext("File Browser"), auth: true },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceLibrary, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceLibrary, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -284,8 +287,7 @@ export default [
meta: { title: $gettext("Hidden Files"), auth: true },
props: { staticFilter: { hidden: true } },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceLibrary, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceLibrary, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -298,8 +300,7 @@ export default [
component: Errors,
meta: { title: appName, auth: true },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceLibrary, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceLibrary, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -345,8 +346,7 @@ export default [
meta: { title: $gettext("Library"), auth: true, background: "application-light" },
props: { tab: "library-index" },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceLibrary, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceLibrary, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -360,8 +360,7 @@ export default [
meta: { title: $gettext("Library"), auth: true, background: "application-light" },
props: { tab: "library-import" },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceLibrary, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceLibrary, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -375,8 +374,7 @@ export default [
meta: { title: $gettext("Library"), auth: true, background: "application-light" },
props: { tab: "library-logs" },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceLibrary, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceLibrary, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -395,8 +393,7 @@ export default [
},
props: { tab: "settings-general" },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceSettings, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceSettings, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -415,8 +412,7 @@ export default [
},
props: { tab: "settings-library" },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceSettings, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceSettings, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -435,8 +431,7 @@ export default [
},
props: { tab: "settings-sync" },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceSettings, aclActions.ActionRead)) {
+ if (hasPermission(aclResources.ResourceSettings, aclActions.ActionRead)) {
next();
} else {
next({ name: "home" });
@@ -454,8 +449,7 @@ export default [
},
props: { tab: "settings-account" },
beforeEnter: (to, from, next) => {
- const userrole = session.getUser().getRole();
- if (acl().accessAllowed(userrole, aclResources.ResourceUsers, aclActions.ActionUpdateSelf)) {
+ if (hasPermission(aclResources.ResourceUsers, aclActions.ActionUpdateSelf)) {
next();
} else {
next({ name: "home" });
diff --git a/internal/acl/actions.go b/internal/acl/actions.go
index f009664a9..30b538c66 100644
--- a/internal/acl/actions.go
+++ b/internal/acl/actions.go
@@ -11,6 +11,7 @@ const (
ActionUpdate Action = "update"
ActionUpdateSelf Action = "update-self"
ActionDelete Action = "delete"
+ ActionArchive Action = "archive" // includes restore
ActionPrivate Action = "private"
ActionUpload Action = "upload"
ActionDownload Action = "download"
diff --git a/internal/api/batch.go b/internal/api/batch.go
index 29a88a8ea..cefa86412 100644
--- a/internal/api/batch.go
+++ b/internal/api/batch.go
@@ -21,7 +21,7 @@ import (
// POST /api/v1/batch/photos/archive
func BatchPhotosArchive(router *gin.RouterGroup) {
router.POST("/batch/photos/archive", func(c *gin.Context) {
- s := Auth(SessionID(c), acl.ResourcePhotos, acl.ActionDelete)
+ s := Auth(SessionID(c), acl.ResourcePhotos, acl.ActionArchive)
if s.Invalid() {
AbortUnauthorized(c)
@@ -84,7 +84,7 @@ func BatchPhotosArchive(router *gin.RouterGroup) {
// POST /api/v1/batch/photos/restore
func BatchPhotosRestore(router *gin.RouterGroup) {
router.POST("/batch/photos/restore", func(c *gin.Context) {
- s := Auth(SessionID(c), acl.ResourcePhotos, acl.ActionDelete)
+ s := Auth(SessionID(c), acl.ResourcePhotos, acl.ActionArchive)
if s.Invalid() {
AbortUnauthorized(c)
| | | | | | | |