#8364 empty ProjectRole cleanup

v1.14.0
closed
None
General
nobody
2022-09-23
2020-06-03
No

Removing a user from a permission (e.g. via UI or from add_user_to_group.py) leaves an empty project role record like:

{ "_id" : ObjectId("5d4da66907ae31602eafd9b7"), "project_id" : ObjectId("5d4da66907ae31602eafd9b1"), "user_id" : ObjectId("538f723ff697c62562ed9a43"), "name" : null, "roles" : [ ] }

As far as I can tell that doesn't serve any purpose and should be removed. Worth testing a bit more to confirm though.

Then script up removal of those records and change ProjectRole remove code.

Semi-related add_user_to_group.py shouldn't merely flush_all(), it should flush individual records or expunge records after its done with them, so that doesn't accumulate a giant list of objects in its ming session.

Discussion

  • Dave Brondsema

    Dave Brondsema - 2021-05-27
    • status: open --> review
    • assigned_to: Dave Brondsema
     
  • Dave Brondsema

    Dave Brondsema - 2021-05-27

    on branch db/8364

    general cleanup is not really necessary, but can be done with

    db.project_role.remove({user_id:{$ne:null}, roles:[]});
    
     
  • Dillon Walls - 2021-06-10
    • status: review --> closed
     
  • Dillon Walls - 2021-06-10

    Fixes are merged.

     
  • Dave Brondsema

    Dave Brondsema - 2022-09-23
    • Milestone: unreleased --> v1.14.0
     

Log in to post a comment.