You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@allura.apache.org by Dave Brondsema <da...@brondsema.net> on 2021/05/27 14:41:12 UTC

[allura:tickets] #8364 empty ProjectRole cleanup

- **status**: open --> review
- **assigned_to**: Dave Brondsema
- **Comment**:

on branch db/8364

general cleanup is not really necessary, but can be done with
```
db.project_role.remove({user_id:{$ne:null}, roles:[]});
```



---

** [tickets:#8364] empty ProjectRole cleanup**

**Status:** review
**Milestone:** unreleased
**Created:** Wed Jun 03, 2020 07:16 PM UTC by Dave Brondsema
**Last Updated:** Wed Jun 03, 2020 07:16 PM UTC
**Owner:** Dave Brondsema


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.


---

Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/

To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.