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

Catch develop up with master #952

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5bff380
Use bitwize operators to check for roles
Jan 3, 2017
5e36d80
Add validator role
Jan 3, 2017
5070100
Add filter options to users list
Jan 3, 2017
6c50f3d
Only one update per task
Jan 10, 2017
df20cc9
Optionaly require validator role for projects
Jan 10, 2017
b651514
Merge pull request #931 from pgiraud/validator_role
Jan 19, 2017
2d94c03
We now have 6 users in the tests
Jan 19, 2017
13bdd08
Merge pull request #951 from pgiraud/tests_fix
Jan 19, 2017
00ecc77
Adding missing space after line break in error msg
Jan 20, 2017
28301a3
Merge pull request #953 from hotosm/pgiraud-patch-1
Jan 20, 2017
0456d25
Fix broken private users list selection
Jan 25, 2017
835ab6f
Add support for labels for projects
Dec 23, 2016
c32a2ea
Merge pull request #921 from pgiraud/project-labels
Jan 25, 2017
01986ee
Use bitwize comparison for the first logged user
Jan 25, 2017
43049be
Fix wrong query with allowed users filter
Jan 25, 2017
0985cc8
Merge pull request #965 from pgiraud/first_user_login
Jan 27, 2017
bda6ffe
Modify Overpass-turbo fullscreen queries
ethan-nelson Feb 2, 2017
b582483
Merge pull request #966 from pgiraud/search_query_normal_user
Feb 7, 2017
f20a97d
Merge pull request #963 from pgiraud/fix_private_users_list
Feb 7, 2017
ebb214f
Adding experienced mapper role
Jan 19, 2017
a331245
Merge pull request #954 from pgiraud/experienced_mapper
Feb 10, 2017
2439e0f
Typo
Feb 12, 2017
35c2aa6
Use describe to get git version
Feb 12, 2017
13a7525
Improve projects tasks as json query
Feb 14, 2017
ee5c45a
Require postGIS 2.3
Feb 14, 2017
d3a3b70
Commented out josm test to display gpx file link
bgirardot Mar 1, 2017
d1b88a8
Use static_path instead of static_url
Mar 2, 2017
15fdc58
Merge pull request #973 from pgiraud/git-version
pgiraud Mar 11, 2017
ce5b870
Merge pull request #974 from pgiraud/tasks-json
pgiraud Mar 11, 2017
a4efc1e
Adds security notice to README
bgirardot May 16, 2017
bfe7e0d
update in readme file.
baladkb May 28, 2017
a18dcec
patch sql vulnerability and remove security warning
Jun 15, 2017
cad2b82
Merge pull request #987 from david-hotosm/sql-fix
david-hotosm Jun 15, 2017
d5dc572
Fix typo in views.py
jbelien Jun 23, 2017
3f91465
Merge pull request #978 from pgiraud/static_path_https
pgiraud Aug 23, 2017
a9ab83d
Merge pull request #986 from baladkb/patch-1
pgiraud Aug 23, 2017
166f78a
Fix flake8 error
pgiraud Aug 23, 2017
8b51531
fix link (#994)
harry-wood Sep 10, 2017
819812c
README version clarifications (#997)
harry-wood Oct 17, 2017
ec44d51
Don't use bare exception (#1006)
pgiraud Jun 15, 2018
281eb61
Switch OSM API to https (#1005)
ethan-nelson Jun 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "osmtm/static/js/lib/moment"]
path = osmtm/static/js/lib/moment
url = https://github.com/moment/moment.git
[submodule "osmtm/static/js/lib/colorselector"]
path = osmtm/static/js/lib/colorselector
url = https://github.com/flaute/bootstrap-colorselector.git
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ cache:
- $HOME/.cache/pip
- $HOME/build/hotosm/osm-tasking-manager2/env

sudo: false
dist: trusty

addons:
postgresql: "9.3"

before_install:
- deactivate
- sudo apt-get install --no-install-recommends postgresql-9.3-postgis-2.3


install:
- virtualenv env
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# OpenStreetMap Tasking Manager
# OpenStreetMap Tasking Manager v2

[![Build Status](https://travis-ci.org/hotosm/osm-tasking-manager2.svg?branch=master)](https://travis-ci.org/hotosm/osm-tasking-manager2)
[![Coverage Status](https://coveralls.io/repos/hotosm/osm-tasking-manager2/badge.png?branch=master)](https://coveralls.io/r/hotosm/osm-tasking-manager2?branch=master)

## About

OSMTM enables collaborative work on specific areas in OpenStreetMap by defining
OpenStreetMap Tasking Manager enables collaborative work on specific areas in OpenStreetMap by defining
clear workflows to be achieved and by breaking tasks down into pieces.

The application is written in Python using the Pyramid framework.
This is version 2.0 of the Tasking Manager.
**[Most development work is now taking place on version 3.0](https://github.com/hotosm/tasking-manager/)**

This is the 2.0 version of the Tasking Manager.

See a list of Tasking Manager installations [here](http://wiki.openstreetmap.org/wiki/OSM_Tasking_Manager#Operational_installations_of_the_Tasking_Manager).
V2 Tasking Manager still powers [many Tasking Manager installations](https://wiki.openstreetmap.org/wiki/OSM_Tasking_Manager#Operational_installations_of_the_Tasking_Manager).
It is written in Python using the Pyramid framework.

## Installation

Expand All @@ -33,8 +33,8 @@ To create a virtual Python environment:

### Database

OSMTM requires a PostgreSQL/PostGIS database. Version 2.x of PostGIS is
required.
OSMTM requires a PostgreSQL/PostGIS database. Version 2.3 or higher of PostGIS
is required.

First create a database user/role named `www-data`:

Expand All @@ -45,7 +45,7 @@ Then create a database named `osmtm`:
sudo -u postgres createdb -T template0 osmtm -E UTF8 -O www-data
sudo -u postgres psql -d osmtm -c "CREATE EXTENSION postgis;"

### Local settings
### Local settings

You certainly will need some local specific settings, like the db user or
password. For this, you can create a `local.ini` file in the project root,
Expand Down Expand Up @@ -89,12 +89,12 @@ You need to make the following changes to the osmtm/views/osmauth.py file.
import httplib2
httplib2.debuglevel = 4
PROXY = httplib2.ProxyInfo(httplib2.socks.PROXY_TYPE_HTTP_NO_TUNNEL, 'PROXY-SERVER', PROXY-PORT)
NOTE: Replace the PROXY-SERVER with your proxy server address and PROXY-PORT with the port number on which your proxy is established.
# then add "proxy_info=PROXY" for every line in oauth.Client.

NOTE: Replace the PROXY-SERVER with your proxy server address and PROXY-PORT with the port number on which your proxy is established.

# then add "proxy_info=PROXY" for every line in oauth.Client.
client = oauth.Client(consumer, proxy_info=PROXY)

client = oauth.Client(consumer, token, proxy_info=PROXY)

Replace the host address in the development.ini file with your IP address of the system.
Expand Down
28 changes: 28 additions & 0 deletions alembic/versions/11695ee852ff_add_validator_role.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Add validator role

Revision ID: 11695ee852ff
Revises: 4fe2d91d0354
Create Date: 2017-01-03 16:23:51.667472

"""

# revision identifiers, used by Alembic.
revision = '11695ee852ff'
down_revision = '4fe2d91d0354'

from alembic import op
import sqlalchemy as sa


def upgrade():
users = sa.sql.table('users', sa.sql.column('role'))
''' Project managers are validators by default '''
op.execute(users.update().values(role=users.c.role.op('#')(4))
.where(users.c.role.op('&')(2)!=0))
pass


def downgrade():
users = sa.sql.table('users', sa.sql.column('role'))
op.execute(users.update().values(role=users.c.role.op('#')(4)))
pass
22 changes: 22 additions & 0 deletions alembic/versions/1bdc819ae210_adding_experienced_mapper_role.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Adding experienced mapper role

Revision ID: 1bdc819ae210
Revises: 4a5bf96b558d
Create Date: 2017-01-19 14:10:58.578127

"""

# revision identifiers, used by Alembic.
revision = '1bdc819ae210'
down_revision = '4a5bf96b558d'

from alembic import op
import sqlalchemy as sa


def upgrade():
op.add_column('project', sa.Column('requires_experienced_mapper_role', sa.Boolean(), nullable=True))


def downgrade():
op.drop_column('project', 'requires_experienced_mapper_role')
47 changes: 47 additions & 0 deletions alembic/versions/4a5bf96b558d_add_project_labels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""Add project labels

Revision ID: 4a5bf96b558d
Revises: 5581aa8a3cd
Create Date: 2016-06-02 23:42:17.332659

"""

# revision identifiers, used by Alembic.
revision = '4a5bf96b558d'
down_revision = '5581aa8a3cd'

from alembic import op
import sqlalchemy as sa


def upgrade():
op.create_table(
'label',
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('name', sa.Unicode),
sa.Column('color', sa.Unicode),
)


project_labels_table = op.create_table(
'project_labels',
sa.Column('project', sa.Integer),
sa.Column('label', sa.Integer),
sa.ForeignKeyConstraint(['project'], ['project.id']),
sa.ForeignKeyConstraint(['label'], ['label.id'])
)

label_translation_table = op.create_table(
'label_translation',
sa.Column('id', sa.Integer, nullable=False),
sa.Column('locale', sa.String(10), nullable=False),
sa.Column('description', sa.String),
sa.UniqueConstraint('id', 'locale'),
sa.ForeignKeyConstraint(['id'], ['label.id'], ondelete="CASCADE")
)


def downgrade():
op.drop_table('project_labels')
op.drop_table('label_translation')
op.drop_table('label')
30 changes: 30 additions & 0 deletions alembic/versions/4fe2d91d0354_update_user_roles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Update user roles

Revision ID: 4fe2d91d0354
Revises: 5002e75c0604
Create Date: 2017-01-03 15:24:32.395665

"""

# revision identifiers, used by Alembic.
revision = '4fe2d91d0354'
down_revision = '5002e75c0604'

from alembic import op
import sqlalchemy as sa


def upgrade():
users = sa.sql.table('users', sa.sql.column('role'))
''' No null values for role '''
op.execute(users.update().values(role=0).where(users.c.role==None))
''' Admins are also project managers '''
op.execute(users.update().values(role=3).where(users.c.role==1))
pass


def downgrade():
users = sa.sql.table('users', sa.sql.column('role'))
op.execute(users.update().values(role=None).where(users.c.role==0))
op.execute(users.update().values(role=1).where(users.c.role==3))
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Add requires_validator_role in project table

Revision ID: 5581aa8a3cd
Revises: 11695ee852ff
Create Date: 2017-01-10 11:18:46.081801

"""

# revision identifiers, used by Alembic.
revision = '5581aa8a3cd'
down_revision = '11695ee852ff'

from alembic import op
import sqlalchemy as sa


def upgrade():
op.add_column('project', sa.Column('requires_validator_role', sa.Boolean(), nullable=True))


def downgrade():
op.drop_column('project', 'requires_validator_role')
21 changes: 21 additions & 0 deletions osmtm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import bleach
import subprocess
import os
from pyramid.config import Configurator
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
Expand Down Expand Up @@ -27,11 +29,19 @@
scheduler.start()


try:
version = subprocess.check_output(['git', 'describe', '--always'],
cwd=os.path.dirname(__file__))
except Exception as e:
version = 'N/A'


def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
settings['mako.directories'] = 'osmtm:templates'
load_local_settings(settings)
settings.update({'version': version})

engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Expand Down Expand Up @@ -106,6 +116,9 @@ def main(global_config, **settings):
config.add_route('task_validate',
'/project/{project:\d+}/task/{task:\d+}/validate',
xhr=True)
config.add_route('task_cancel_done',
'/project/{project:\d+}/task/{task:\d+}/cancel_done',
xhr=True)
config.add_route('task_comment',
'/project/{project:\d+}/task/{task:\d+}/comment',
xhr=True)
Expand All @@ -126,13 +139,21 @@ def main(global_config, **settings):
config.add_route('task_users',
'/project/{project:\d+}/task/{task:\d+}/users')

config.add_route('labels', '/labels')
config.add_route('label_new', '/label/new')
config.add_route('label_edit', '/label/{label:\d+}/edit')
config.add_route('label_delete', '/label/{label:\d+}/delete')

config.add_route('users', '/users')
config.add_route('users_json', '/users.json')
config.add_route('user_messages', '/user/messages')
config.add_route('user_messages_check', '/user/messages/check')
config.add_route('user', '/user/{username}')
config.add_route('user_admin', '/user/{id:\d+}/admin')
config.add_route('user_project_manager', '/user/{id:\d+}/project_manager')
config.add_route('user_validator', '/user/{id:\d+}/validator')
config.add_route('user_experienced_mapper',
'/user/{id:\d+}/experienced_mapper')
config.add_route('user_prefered_editor',
'/user/prefered_editor/{editor}', xhr=True)
config.add_route('user_prefered_language',
Expand Down
13 changes: 13 additions & 0 deletions osmtm/mako_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ def repl(val):
return re.sub(p, repl, text)

return d


def contrast(color):
from colour import Color
'''Returns better constrast color between white and black for the given
color
'''
color = Color(color)
if (color.red * 256 * 0.299 + color.green * 256 * 0.587 +
color.blue * 256 * 0.114) > 186:
return 'black'
else:
return 'white'
Loading