{"action":"created","issue":{"url":"https://api.github.com/repos/Narzerus/angular-permission/issues/346","repository_url":"https://api.github.com/repos/Narzerus/angular-permission","labels_url":"https://api.github.com/repos/Narzerus/angular-permission/issues/346/labels{/name}","comments_url":"https://api.github.com/repos/Narzerus/angular-permission/issues/346/comments","events_url":"https://api.github.com/repos/Narzerus/angular-permission/issues/346/events","html_url":"https://github.com/Narzerus/angular-permission/issues/346","id":184741089,"number":346,"title":"Issue with version 4.1.1","user":{"login":"brunowego","id":441774,"avatar_url":"https://avatars.githubusercontent.com/u/441774?v=3","gravatar_id":"","url":"https://api.github.com/users/brunowego","html_url":"https://github.com/brunowego","followers_url":"https://api.github.com/users/brunowego/followers","following_url":"https://api.github.com/users/brunowego/following{/other_user}","gists_url":"https://api.github.com/users/brunowego/gists{/gist_id}","starred_url":"https://api.github.com/users/brunowego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brunowego/subscriptions","organizations_url":"https://api.github.com/users/brunowego/orgs","repos_url":"https://api.github.com/users/brunowego/repos","events_url":"https://api.github.com/users/brunowego/events{/privacy}","received_events_url":"https://api.github.com/users/brunowego/received_events","type":"User","site_admin":false},"labels":[{"id":126363919,"url":"https://api.github.com/repos/Narzerus/angular-permission/labels/invalid","name":"invalid","color":"e6e6e6","default":true}],"state":"closed","locked":false,"assignee":{"login":"masterspambot","id":581121,"avatar_url":"https://avatars.githubusercontent.com/u/581121?v=3","gravatar_id":"","url":"https://api.github.com/users/masterspambot","html_url":"https://github.com/masterspambot","followers_url":"https://api.github.com/users/masterspambot/followers","following_url":"https://api.github.com/users/masterspambot/following{/other_user}","gists_url":"https://api.github.com/users/masterspambot/gists{/gist_id}","starred_url":"https://api.github.com/users/masterspambot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterspambot/subscriptions","organizations_url":"https://api.github.com/users/masterspambot/orgs","repos_url":"https://api.github.com/users/masterspambot/repos","events_url":"https://api.github.com/users/masterspambot/events{/privacy}","received_events_url":"https://api.github.com/users/masterspambot/received_events","type":"User","site_admin":false},"assignees":[{"login":"masterspambot","id":581121,"avatar_url":"https://avatars.githubusercontent.com/u/581121?v=3","gravatar_id":"","url":"https://api.github.com/users/masterspambot","html_url":"https://github.com/masterspambot","followers_url":"https://api.github.com/users/masterspambot/followers","following_url":"https://api.github.com/users/masterspambot/following{/other_user}","gists_url":"https://api.github.com/users/masterspambot/gists{/gist_id}","starred_url":"https://api.github.com/users/masterspambot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterspambot/subscriptions","organizations_url":"https://api.github.com/users/masterspambot/orgs","repos_url":"https://api.github.com/users/masterspambot/repos","events_url":"https://api.github.com/users/masterspambot/events{/privacy}","received_events_url":"https://api.github.com/users/masterspambot/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2016-10-24T03:22:53Z","updated_at":"2016-12-31T10:46:43Z","closed_at":"2016-11-22T16:59:59Z","body":"After update to version 4.1.1 I get the error bellow:\n\n``` sh\nTypeError: i[r].validationFunction.indexOf is not a function\n    at http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:15:16333\n    at Object.r [as forEach] (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:5:24003)\n    at e.t (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:15:16173)\n    at http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:15:13949\n    at Object.a [as invoke] (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:6:11955)\n    at i.validatePermission (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:1:15940)\n    at http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:1:20541\n    at Array.map (native)\n    at s.resolvePropertyValidity (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:1:20368)\n    at i (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:1:19143)\n```\n\nIts happen when uglify with webpack. If return to version 4.0.6 works perfectly. Thanks.\n"},"comment":{"url":"https://api.github.com/repos/Narzerus/angular-permission/issues/comments/269859639","html_url":"https://github.com/Narzerus/angular-permission/issues/346#issuecomment-269859639","issue_url":"https://api.github.com/repos/Narzerus/angular-permission/issues/346","id":269859639,"user":{"login":"brunowego","id":441774,"avatar_url":"https://avatars.githubusercontent.com/u/441774?v=3","gravatar_id":"","url":"https://api.github.com/users/brunowego","html_url":"https://github.com/brunowego","followers_url":"https://api.github.com/users/brunowego/followers","following_url":"https://api.github.com/users/brunowego/following{/other_user}","gists_url":"https://api.github.com/users/brunowego/gists{/gist_id}","starred_url":"https://api.github.com/users/brunowego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brunowego/subscriptions","organizations_url":"https://api.github.com/users/brunowego/orgs","repos_url":"https://api.github.com/users/brunowego/repos","events_url":"https://api.github.com/users/brunowego/events{/privacy}","received_events_url":"https://api.github.com/users/brunowego/received_events","type":"User","site_admin":false},"created_at":"2016-12-31T10:46:43Z","updated_at":"2016-12-31T10:46:43Z","body":"Only works with version 4.0.6 the follow settings:\r\n\r\n```js\r\n# permissions.run.js\r\nconst PermissionsRun = (PermPermissionStore, PermRoleStore, AuthService, $state, $rootScope) => {\r\n  'ngInject';\r\n\r\n  let permissions = [\r\n    'dashboard', 'disputes', 'remittances', ...\r\n  ];\r\n\r\n  PermPermissionStore.defineManyPermissions(permissions, (permissionName) => {\r\n    return AuthService.hasPermission(permissionName);\r\n  });\r\n\r\n  PermRoleStore.defineManyRoles({\r\n    'SUPERVISOR': ['dashboard', 'disputes', 'remittances'],\r\n    'GUEST': ['dashboard', 'disputes']\r\n  });\r\n\r\n  const deniedHandle = $rootScope.$on('$stateChangePermissionDenied', () => $state.go('auth.login'));\r\n\r\n  $rootScope.$on('$destroy', () => {\r\n    deniedHandle();\r\n  });\r\n};\r\n\r\nexport default PermissionsRun;\r\n```\r\n\r\n```js\r\n# auth.service.js\r\nimport angular from 'angular';\r\n\r\nclass AuthService {\r\n  ...\r\n\r\n  hasPermission(permission) {\r\n    let deferred = this.$q.defer();\r\n    let hasPermission = false;\r\n\r\n    // Check if user has permission via its roles.\r\n    angular.forEach(this.currentUser().roles, (role) => {\r\n      // Check role exists.\r\n      if (this.role.hasRoleDefinition(role)) {\r\n        let roles = this.role.getStore();\r\n\r\n        if (angular.isDefined(roles[role])) {\r\n          // Check if the permission we are validating is in this role's permissions.\r\n          if (-1 !== roles[role].validationFunction.indexOf(permission)) {\r\n            hasPermission = true;\r\n          }\r\n        }\r\n      }\r\n    });\r\n\r\n    // If we have permission resolve otherwise reject the promise.\r\n    if (hasPermission) {\r\n      deferred.resolve();\r\n    } else {\r\n      deferred.reject();\r\n    }\r\n\r\n    return deferred.promise;\r\n  }\r\n\r\n  ...\r\n}\r\n```\r\n\r\n@AlainD- did you use the latest version?"}}
{"actor":{"display_login":"brunowego"}}