question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with version 4.1.1

See original GitHub issue

After update to version 4.1.1 I get the error bellow:

TypeError: i[r].validationFunction.indexOf is not a function
    at http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:15:16333
    at Object.r [as forEach] (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:5:24003)
    at e.t (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:15:16173)
    at http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:15:13949
    at Object.a [as invoke] (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:6:11955)
    at i.validatePermission (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:1:15940)
    at http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:1:20541
    at Array.map (native)
    at s.resolvePropertyValidity (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:1:20368)
    at i (http://app.sistemamais.com.br/main.d8eb1933d403ee234700.bundle.js:1:19143)

Its happen when uglify with webpack. If return to version 4.0.6 works perfectly. Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
AlainD-commented, Nov 22, 2016

@masterspambot I don’t really need to check the existence of validationFunction. What I need is a way of saying if a user who has a given role has a specific permission.

Let me explain: I have an application client-server.

The server handles a list of users. These users are assigned a list of roles. Let say a user User01 is ROLE_ADMIN and ROLE_EDITOR:

{
    "username": "user01",
    "name": "User01",
    "roles": ["ROLE_ADMIN", "ROLE_EDITOR"]
}

In the client, my angularjs application, I defined a roleStore and a permissionStore. Let says for instance

{
    "ROLE_ADMIN": ["canCreateUser", "canUpdateUser"],
    "ROLE_EDITOR": ["canEditPage", "canEditSection"],
    "ROLE_VALIDATOR": ["canValidateThis", "canValidateThat"]
}

Those permissions are only used for the front-end (client) to access certain pages, or menus…

Now if I create a section in the front-end which is restricted to permission-only="canEditSection", it is natural to define the validation of the store by using a method to check if the user has this permission. Since the backend does not know anything about the permissions of the front-end, I need to know if among the permission store defined, a certain role (one of the user’s) has the permission ‘canEditSection’.

So as you see, the validation is not just checking the existence of the roleDefinition, or the existence of the permission definition, but it is to know if the permission is associated to a given/named role. Before v4.x validationFunction seemed to provide us with that mapping, but since v4.x this info seems to be missing. It like we can only check if the permission definition exists or the role definition exists, and that’s it. Or did I misunderstand something?

2reactions
AlainD-commented, Oct 31, 2016

Repying to myself:

OK, I think I understand why this is happening. Before, in v3.2.1 the constructor: function Role(roleName, validationFunction) {...} could return an Array if the validationFunctionparameter was defined as an array: this.validationFunction = validationFunction;

But now in v4.1.1, we have this.validationFunction = annotateValidationFunction(validationFunction);which now returns a Function no matter what type of the parameter of the constructor. Moreover, that function seems to be a promise.

So, in my service, if I use instead: roles[roleName].validationFunction().then(...), I get a too many recursion error. Now I’m stuck! 😕

Some help to make us see clear would be much appreciated 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fatal error with with version 4.1.0 and 4.1.1 - WordPress.org
I've managed to roll back to an older version that was still working (4.0.6, fwiw), so this isn't as urgent, but you should...
Read more >
Samsung One UI 4.0, 4.1 & 4.1.1 (Android 12) update bug ...
A detailed & continuously updated round-up of everything related to Samsung One UI 4.0, 4.1 & 4.1.1 bugs, issues, and problems.
Read more >
Android Studio 4.1.1 available
Issue #152941155: Feature Request: Project Property with Android Studio version. Issue #160269604: Run command often does not start activity.
Read more >
Android 4.1.1 Still Vulnerable to Heartbleed - PCMag
While Google has applied patches to many of its top products in response to the Heartbleed bug, Android 4.1.1 is still vulnerable, ...
Read more >
Revoscan Mac Version 4.1.1? - Issues & Faults - Revopoint 3D
This wikiHow teaches you how to install software that isn't approved by Apple on your Mac. MacOS Sierra marks most unofficial apps as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found