Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add tag permissions to allow non-owner to edit #5436

Merged
merged 1 commit into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default async function updateTag(context, input) {
const { shopId, tagId, slug: slugInput } = input;

// Check for owner or admin permissions from the user before allowing the mutation
if (!userHasPermission(["owner", "admin"], shopId)) {
if (!userHasPermission(["owner", "admin", "tag/admin", "tag/edit"], shopId)) {
throw new ReactionError("access-denied", "User does not have permission");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function productsByTagId(context, params) {
const { Products, Tags } = collections;

// Check for owner or admin permissions from the user before allowing the query
if (!userHasPermission(["owner", "admin"], shopId)) {
if (!userHasPermission(["owner", "admin", "tag/admin", "tag/edit"], shopId)) {
throw new ReactionError("access-denied", "User does not have permission");
}

Expand Down
10 changes: 10 additions & 0 deletions imports/plugins/core/tags/server/no-meteor/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ export default async function register(app) {
dashboardSize: "md"
}
}
}, {
route: "tag/admin",
label: "Tag Admin",
permission: "tagAdmin",
name: "tag/admin"
}, {
route: "tag/edit",
label: "Edit Tag",
permission: "tagEdit",
name: "tag/edit"
}],
layout: [{
layout: "coreLayout",
Expand Down