Skip to content

Role elevation failure message #1107

Closed

Description

@Martii

stderr:

2017-05-07 11:26:27.143 +00:00: MongoDB User save warning error
abego was NOT role elevated from User to Author with err of:
{
 "code": 11000,
 "index": 0,
 "errmsg": "E11000 duplicate key error index: openuserjs.users.$_id_ dup key: { : ObjectId('*thisObjectIdHashClipped*') }",
 "op": {
  "__v": 0,
  "name": "abego",
  "role": 4,
  "ghUsername": "*clipped*",
  "_id": "*thisObjectIdHashClipped*",
  "sessionIds": [],
  "strategies": [
   "*someAuthStrategy*"
  ],
  "auths": [
   "*clipped*"
  ]
 }
}

Current code point where this is generated when storing a script for the first time: .../blob/fac5ba5/controllers/scriptStorage.js#L1253-L1273

Refs:

User stat:

 Stats

Member since
    8h ago
Number of userscripts
    1
Number of libraries
    0
Total installs
    0
Average installs
    0
Average rating
    0

Script stat:

Published: 6h ago

Version: 1.0

I will go ahead and elevate when these come through but this should be addressed so I don't have more work as Admin. (Manually elevated user abego)

Cc: @sizzlemctwizzle

Activity

  1. added
    bugYou've guessed it... this means a bug is reported.
    CODESome other Code related issue and it should clearly describe what it is affecting in a comment.
    DBPertains inclusively to the Database operations.
    soonerSooner would be appreciated.
    on May 7, 2017
  2. added a commit that references this issue on May 8, 2017
    e2dd60a
  3. self-assigned this
    on May 8, 2017
  4. added a commit that references this issue on May 8, 2017
    eaebe01
  5. removed
    soonerSooner would be appreciated.
    on May 8, 2017
  6. removed their assignment
    on May 8, 2017
  7. Martii commented on May 8, 2017

    @Martii
    MemberAuthor

    Fully tested PR on dev by demoting myself to User then using GH import and does trigger this portion of the conditional... and elevates to Author. Pro keeps me at Admin level... which it should since that's outside the initial conditional... but triple checking to be secure.

  8. sizzlemctwizzle commented on May 9, 2017

    @sizzlemctwizzle
    Member

    My best guess is that instead of creating a new duplicate userDoc, retrieve the real one using find(), modify the role, save() it, and in the save callback, call the update method of libs/modifySessions.js to make sure the change is propagated in the session store.

  9. sizzlemctwizzle commented on May 9, 2017

    @sizzlemctwizzle
    Member

    Didn't notice this was already closed. Did your PR take into account saving the modified user doc doesn't propogate the change in role across active sessions?

  10. Martii commented on May 10, 2017

    @Martii
    MemberAuthor

    My best guess is that instead of creating a new duplicate userDoc, retrieve the real one using find(), modify the role, save() it, and in the save callback, ...

    This is what the PR does... however...

    call the update method of libs/modifySessions.js to make sure the change is propagated in the session store.

    This was never present before or after the PR. e.g. the new User(userDoc) ended at that. See .../pull/1108/files#diff-b755ddbL1258

    Did your PR take into account saving the modified user doc doesn't propogate the change in role across active sessions?

    See last response... e.g. never was there in the first place... understand the logic behind it though... just not sure where in the code to put the session change in. See prior emails about session managements.

    Didn't notice this was already closed

    Tiz okay... I follow everything. :) If there is a missing session propagation change a new issue would be preferable since it never existed.

  11. locked as resolved and limited conversation to collaborators on Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CODESome other Code related issue and it should clearly describe what it is affecting in a comment.DBPertains inclusively to the Database operations.bugYou've guessed it... this means a bug is reported.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions