These are chat archives for reactioncommerce/reaction

7th
Jul 2015
Bogi
@boboci9
Jul 07 2015 09:31
Hi @aaronjudd, just a quick question, when you check for the hasPermissions in the app.coffee on client side, could you tell me why do you add the 'owner' and 'admin' roles to the permissions array, this way if you pass a permission along to check for access it will not return true unless the user is admin too
 hasPermission: (permissions, userId) ->
    userId = userId || Meteor.userId()
    # assume admin, owner access
    unless _.isArray permissions
      permissions = [permissions]
      permissions.push "admin", "owner"

    if Roles.userIsInRole userId, permissions, @shopId
      return true
    else if Roles.userIsInRole userId, permissions, Roles.GLOBAL_GROUP
      return true
    for shop in @getSellerShopId()
      if Roles.userIsInRole userId, permissions, shop
        return true  
    return false
Aaron Judd
@aaronjudd
Jul 07 2015 15:19
@boboci9 permissions can be an array. I think it should be working as “or”, not “and”. It’s not? See: http://alanning.github.io/meteor-roles/classes/Roles.html#method_userIsInRole If array, will return true if user is in any role.
Bogi
@boboci9
Jul 07 2015 15:46

but then in the dropdown.html you have

 {{#if hasPermission route}}
    <li class="dropdown-apps-icon">

which is never an array so the admin and owner are all the times attached

Bogi
@boboci9
Jul 07 2015 16:01
ok sorry disregard this last message I didn't understood you correctly the first time
Aaron Judd
@aaronjudd
Jul 07 2015 16:23
right, so that one isn’t just checking admin/owner, but rather just the contents of route (or owner, or admin)
Bogi
@boboci9
Jul 07 2015 16:46
ok thanks, something was not adding up for me and I thought it's because those rights there but I was wrong
Spencer Norman
@spencern
Jul 07 2015 18:01
Anyone else seeing client-integration tests taking forever to run?
I’m seeing the server-integration tests running through in 4s, and last time my client integration tests finished it was in 597s
Spencer Norman
@spencern
Jul 07 2015 18:08
after a fresh meteor reset and bin/reset and then running meteor with JASMINE_SERVER_UNIT=0 JASMINE_CLIENT_UNIT=0 meteor I’m seeing it reduced to ‘6s’ but the startup time is still pretty high. Way better, but doesn’t feel fast
Aaron Judd
@aaronjudd
Jul 07 2015 18:09
can’t really say I’ve seen that, but not shocked - as it’s spinning up another version of the app and chrome.. it’s bound to hang up sometimes. I’ve gotten in the bad habit (out of annoyances) of shutting off the test except when I’m specifically testing
Spencer Norman
@spencern
Jul 07 2015 18:11
Fair. I may just do that as well for now
Spencer Norman
@spencern
Jul 07 2015 20:11
Is there a better way to select a specific variant of a product by ID than by doing something like this: (variant for variant in product.variants when variant._id is inventoryVariantId)[0] ?
Aaron Judd
@aaronjudd
Jul 07 2015 23:44
@spencern not really - we should add a method for that