hotosm / osm-tasking-manager2

Designed and built for Humanitarian OpenStreetMap Team collaborative emergency/disaster mapping, the OSM Tasking Manager 2.0 divides an area into individual squares that can be rapidly mapped by thousands of volunteers.
http://tasks.hotosm.org
Other
425 stars 156 forks source link

Validator role #931

Closed pgiraud closed 7 years ago

pgiraud commented 7 years ago

With this pull request a new "validator" role is added.

Users list improved

The list of users is huge and it was not easy to find a user. I've added a search input with autocompletion. screenshot from 2017-01-04 16 02 58

Also it's possible to filter the list by roles. screenshot from 2017-01-04 15 35 12

Perfomances of the users list pages have been improved a lot by doing the sorting on the database and not in python.

New validator role

The users are not allow to review the work done unless they are validators.

The new "validator" role can be given by users with the "project manager" or "administrator" role.

screenshot from 2017-01-04 15 36 00

By default, all the project managers are also given the validator role when migrating the database.

Cancel "marked as done"

In the previous version when a contributor was marking a task as done by mistake and wanted to continue the contribution, he had to review the work, invalidate the task and eventually lock the task again. It was confusing and a bit painful.

I decided to add an "undo" button to let the users cancel / remove the last "marked as done" state. This button appears only when the user is the last one who marked the task as done.

screenshot from 2017-01-04 17 09 22

Per project validation

Each project can be configure to require validator role for validation. Once the checkbox is checked, only users with the validator role are allowed to validate tasks. By default the project can be validated by anyone.

screenshot from 2017-01-10 15 32 30

Working demo

I invite you to play with this by following the url below. http://tasks-hotosm.dev.sig.cloud.camptocamp.net/validator/project/2232

Tip: It's useful to have multiple OSM accounts to play with the different roles yourself. I usually open a new browser window in incognito mode and log in the tasking manager using a different OSM account. Also don't hesitate to ask me if you want me to change your privileges.

bgirardot commented 7 years ago

Very cool!

A couple of quick things:

I like how the validator role works!

Is there a way to require a validator role person for validation on a project by project basis? Like in the Misc. tab a check box for "require validator role for validation" ?

When an experienced validator is needed by a project for some reason, they are needed, but there are probably many projects where an experienced validator would not be required so it would be good if the default were just like the TM is now, but offer project managers the option to require a validator role for the validation.

I also like the "oops not done" button :) I am not sure if it is just my browser, but when I click the undo done button, task coloring does not change back to no color, it stays gold. refreshing the page will update the 'undone'ed task squares. Kind of a minor thing.

I'll try out the user list feature shortly.

pgiraud commented 7 years ago

When an experienced validator is needed by a project for some reason, they are needed, but there are probably many projects where an experienced validator would not be required so it would be good if the default were just like the TM is now, but offer project managers the option to require a validator role for the validation.

I personally think that it's better if tasks are not validated than validated by anyone. With the validator role, if a project has a lot of tasks marked as done it means that the work is potentially correct but the validation still needs to be done. If on most projects we let anyone do the validation we won't be able to tell if the validated tasks are "really" completed or not. Just like it is now. If a project is 100% done but not 100% validated, it doesn't mean that it's not correctly mapped. Currently if a project is 100% validated, it doesn't mean that it's correctly mapped either. With a strict validator role used on all projects, we should be able to tell. 100% validated project will eventually mean "it's finished!".

For validators, it will also give them more responsibility if they are identified as so. They probably will not want to validate projects if they know that anyone can do the job. Even mappers with no experience.

Currently we have more than 4200 users who validated at least one task. I think that's a lot and I'm pretty sure they didn't do it on purpose. 1664 users validated only one task.

pgiraud commented 7 years ago

I also like the "oops not done" button :) I am not sure if it is just my browser, but when I click the undo done button, task coloring does not change back to no color, it stays gold. refreshing the page will update the 'undone'ed task squares. Kind of a minor thing.

Good catch. I'll fix that.

pgiraud commented 7 years ago

I just changed the code so that validator role is required for projects configured so. Main pull request description updated. Demo updated as well.

bgirardot commented 7 years ago

@pgiraud I am having a hard time testing this. I used my test account, but that test account was an admin and project manager.

I logged in as my main user, also an admin and removed the privileges for my test user, but when logging back in as my test user, that test user was still an admin/project manager.

my test user is bgirardotOSMTest

pgiraud commented 7 years ago

I removed all the privileges for bgirardotOSMTest on the demo instance. Can you please try again?

bgirardot commented 7 years ago

@pgiraud My test user still seems to be admin: http://tasks-hotosm.dev.sig.cloud.camptocamp.net/validator/user/bgirardotOSMTest

I logged in and out of the TM and it still has those privs.

pgiraud commented 7 years ago

I logged in and out of the TM and it still has those privs.

Woot! You found a serious issue. I'm digging into it.

pgiraud commented 7 years ago

@bgirardot Fixed.

bgirardot commented 7 years ago

Can project managers and admins not validate projects, regardless of if they are marked validators? It seems like I can not with my admin/PM account for projects that require validators.

pgiraud commented 7 years ago

For simplicity (in the code) I thought it would be better to separate the different roles and to avoid hierarchy in roles as much as possible. It makes the code easier to read in my opinion and more extensible in the future if we want to add more roles. So yes, users need to be have the "validator" role explicitly if they want to be allowed to validate tasks in projects requiring validators. Project managers and administrators can give this role to themselves, by the way.

bgirardot commented 7 years ago

@pgiraud Can you update the alembic code to just mark all pm's and admins as validators too during the db upgrade process? There is no reason to put extra steps in for the users if we can just do programatically.

pgiraud commented 7 years ago

@bgirardot This should already be the case. https://github.com/pgiraud/osm-tasking-manager2/blob/df20cc993a138a64884189b274c35e11897726cc/alembic/versions/11695ee852ff_add_validator_role.py#L19-L21 Did you encounter any problem while trying to migrate?