Skip to content

Commit

Permalink
fix: dashboard routes available for unauthed users
Browse files Browse the repository at this point in the history
Dashboard routes would be rendered for unauthenticated users who directly enter a url. This commit fixes that issue.
  • Loading branch information
spencern committed Nov 1, 2018
1 parent 55fac48 commit 3d3c4cb
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ function transform(doc, userId) {
registry.permissions = [...permissions];
if (registry.route) {
registry.permissions.push(registry.name || `${doc.name}/${registry.template}`);

// Delete the route if the user doesn't have the correct permissions
if (Roles.userIsInRole(userId, registry.permissions, doc.shopId) === false) {
delete registry.route;
}
}

// We no longer use a settingsKey for "enabled" for some registry types.
Expand Down

0 comments on commit 3d3c4cb

Please sign in to comment.