Skip to content
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

invalid permissions given when a user has valid permissions when queried through a sessionless web service #2554

Closed
nathandunn opened this issue Jan 20, 2021 · 0 comments

Comments

@nathandunn
Copy link
Contributor

ITs because the user is not in the database and the user is not an instructor.

I don't think there is a side-effect right now, but this should be an easy fix.

          if ((!userOrganismPreference || !permissionService.hasAnyPermissions(currentUser)) && !permissionService.isUserBetterOrEqualRank(currentUser, GlobalPermissionEnum.INSTRUCTOR)) {
                userObject.put(FeatureStringEnum.ERROR.value, "You do not have access to any organism on this server.  Please contact your administrator.")
curl 'http://demo.genomearchitect.org/Apollo2/user/checkLogin' \
   -H 'Content-Type: application/json' \
   -X POST \
   -d '{"username":"demo@demo.com","password":"demo"}'

The response looks like this:

{
  "firstName":"Demo",
  "lastName":"User",
  "role":"USER",
  "error":"You do not have access to any organism on this server.  Please contact your administrator.",
  "userId":16,
  "organismPermissions":[
    {
      "organism":"Honeybee",
      "permissions":"[\"WRITE\",\"EXPORT\",\"READ\"]",
      "permissionArray":[
        "WRITE",
        "EXPORT",
        "READ"
      ],
      "id":153217,
      "userId":16
    },
    {
      "organism":"Yeast",
      "permissions":"[\"WRITE\",\"EXPORT\",\"READ\"]",
      "permissionArray":[
        "WRITE",
        "EXPORT",
        "READ"
      ],
      "id":153219,
      "userId":16
    },
    {
      "organism":"Human-Hg38",
      "permissions":"[\"WRITE\",\"EXPORT\",\"READ\"]",
      "permissionArray":[
        "WRITE",
        "EXPORT",
        "READ"
      ],
      "id":153218,
      "userId":16
    },
    {
      "organism":"Yeast 4asdfasdfasdfasfdasdf asdf asdfasdfasdf",
      "permissions":"[\"WRITE\"]",
      "groupId":185085,
      "id":285564
    },
    {
      "organism":"Fictitious",
      "permissions":"[\"WRITE\"]",
      "permissionArray":[
        "WRITE"
      ],
      "id":248994,
      "userId":16
    }
  ],
  "has_users":true,
  "username":"demo@demo.com"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant