-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Marketplace] Feature - Permissions should be settable by placing a user into a predefined group #2448
Merged
Merged
[Marketplace] Feature - Permissions should be settable by placing a user into a predefined group #2448
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
01c94a3
Give all users access to shop selector.
spencern ac4494a
Set ShopId on shop selector change
spencern 8b3df17
Merge branch 'spencer-code-cleanup' into marketplace-shop-switcher
spencern 44ed9bc
Regular Shop Selector should just adjust only the route.
spencern 150514f
Remove empty line at top of navbar
spencern 8947d2c
Change Reaction.shopId to be a ReactiveVar
spencern 9cc050d
Add closeOnClick option to DropDownMenu
spencern 6af82e8
Add shop selector to admin toolbar.
spencern deae717
WIP - tons of code not committed - Init switching away from getSeller…
spencern 6db6fe1
Switches dashboard context as well as published packages based on act…
spencern 71f7073
Init group file
impactmass 0ef424b
create group
impactmass f82956b
Test update
impactmass e82fb99
Considering side effects after group change
impactmass b6b93ef
multi update on groupname
impactmass ee999a9
Updating user after group change
impactmass 1f55590
Simpleschema fix
impactmass 13430c8
Resolve update when group name changes
impactmass 9011584
add combinedroles
impactmass 8d24925
Fix error
impactmass f0cb22c
Init group/addUser
impactmass 951fb0e
Updating user group array and roles
impactmass d997f2a
more error handling on functions
impactmass 448df6f
debug group/adduser
impactmass 005d659
set field to optional
impactmass c547026
Update to remove user
impactmass 71ecdf4
Update to remove user
impactmass 63188cb
Refactoring updates on groups user belongs to
impactmass f688503
Refactoring updates on group name
impactmass 6698d8c
Quick template scaffold to test adding perms to group
impactmass d706316
Connect update method to event
impactmass c263417
Update comments
impactmass 0a54f26
Quickly scaffold component
impactmass 0d8b8fe
Updates from first review
impactmass 2714be1
Adding new values to groups
impactmass 54660d0
Add more fields and uniqueness
impactmass 028faa2
Hopefully final fixes
impactmass ff20eea
Track with id
impactmass 0cbd6da
Switch use of Roles to R.haspermission
impactmass 06936e5
Add tests for createGroup and addUser
impactmass bcfdffd
Update tests and change _id to groupId
impactmass 14276f8
Change to object-type schema
impactmass ae56444
Update tests to match schema
impactmass 407c428
Modify and add test for updateGroup
impactmass 0b10d3c
Merge branch 'marketplace' into seun-create-groups-2184
impactmass fde269b
Remove un-needed ui stuffs
impactmass a81ddb3
Cleanup
impactmass 3931e62
Remove done in before and add method to mock
impactmass 4b62ab6
Fixing tests
impactmass 09340b7
Update to test
impactmass 63c653c
Refactor
impactmass f9f141d
Test changes after refactor
impactmass 4d71287
Fix lint issue
impactmass 8dee184
Initial switching roles to groups
impactmass 8091822
Remove comment in json
impactmass c691632
Fixes on default customer group
impactmass 5d4bb0b
Default guest grp
impactmass c13c9e4
Fixing tests and changes to groups init
impactmass 8e330ee
one group type per shop
impactmass 14e42a2
one group type per shop during init
impactmass f93c76d
Set default group on user when signup
impactmass 26ea9c6
Fixing addDefaultRoles.app-test.js
impactmass fc07e12
Comments and hook function
impactmass b5820e1
Add test fo new group placement
impactmass 4c6c5b1
Remove console log
impactmass b94a22c
Add test for group uniqueness per shop
impactmass 975f8c4
Change addDefaultRoles method to use groups.
spencern File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { Reaction, Hooks } from "/server/api"; | ||
|
||
Hooks.Events.add("afterCoreInit", () => { | ||
Reaction.addRolesToDefaultRoleSet({ | ||
Reaction.addRolesToGroups({ | ||
allShops: true, | ||
roleSets: ["defaultRoles", "defaultVisitorRole"], | ||
groups: ["guest", "customer"], | ||
roles: ["account/verify"] | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
import { Reaction, Hooks, Logger } from "/server/api"; | ||
import { Shops } from "/lib/collections"; | ||
|
||
function addRolesToVisitors() { | ||
// Add the about permission to all default roles since it's available to all | ||
Logger.debug("Adding notification route permissions to default roles"); | ||
const shop = Shops.findOne(Reaction.getShopId()); | ||
Shops.update(shop._id, { | ||
$addToSet: { defaultRoles: "notifications" } | ||
}); | ||
} | ||
import { Reaction, Hooks } from "/server/api"; | ||
|
||
Hooks.Events.add("afterCoreInit", () => { | ||
addRolesToVisitors(); | ||
Reaction.addRolesToGroups({ | ||
allShops: true, | ||
groups: ["guest", "customer"], | ||
roles: ["notifications"] | ||
}); | ||
}); |
4 changes: 2 additions & 2 deletions
4
imports/plugins/included/payments-paypal/server/startup/startup.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { Reaction, Hooks } from "/server/api"; | ||
|
||
Hooks.Events.add("afterCoreInit", () => { | ||
Reaction.addRolesToDefaultRoleSet({ | ||
Reaction.addRolesToGroups({ | ||
allShops: true, | ||
roleSets: ["defaultRoles", "defaultVisitorRole"], | ||
groups: ["customer", "guest"], | ||
roles: ["reaction-paypal/paypalDone", "reaction-paypal/paypalCancel"] | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { SimpleSchema } from "meteor/aldeed:simple-schema"; | ||
|
||
export const Groups = new SimpleSchema({ | ||
name: { | ||
type: String | ||
}, | ||
description: { | ||
type: String, | ||
optional: true | ||
}, | ||
slug: { | ||
type: String | ||
}, | ||
permissions: { | ||
type: [String] | ||
}, | ||
shopId: { | ||
type: String, | ||
regEx: SimpleSchema.RegEx.Id | ||
}, | ||
createdBy: { | ||
type: String, | ||
optional: true, | ||
regEx: SimpleSchema.RegEx.Id, | ||
autoValue: function () { | ||
return this.userId || this.value; | ||
} | ||
}, | ||
createdAt: { | ||
type: Date, | ||
autoValue: function () { | ||
if (this.isInsert) { | ||
return new Date; | ||
} else if (this.isUpsert) { | ||
return { | ||
$setOnInsert: new Date | ||
}; | ||
} | ||
} | ||
}, | ||
updatedAt: { | ||
type: Date, | ||
autoValue: function () { | ||
return new Date; | ||
} | ||
} | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to ensure that defaultRoles are loaded at this point? (e.g.
subscription.ready()
)? Maybe this is done already in another placeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helper is only used in the checkout right now it seems, and even if we load the checkout directly default roles are ready, so I think we're good to go here.