Skip to content

Commit

Permalink
Revert "Restrict access to archived projects" (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-nelson committed May 2, 2016
1 parent 164f1e5 commit d3112e5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 50 deletions.
3 changes: 1 addition & 2 deletions osmtm/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def __init__(self, request):
project_id = request.matchdict['project']
project = DBSession.query(Project).get(project_id)
if project is not None:
if project.status == Project.status_draft or \
project.status == Project.status_archived:
if project.status == Project.status_draft:
acl = [
(Allow, 'group:admin', 'project_show'),
(Allow, 'group:project_manager', 'project_show'),
Expand Down
48 changes: 0 additions & 48 deletions osmtm/tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,27 +537,6 @@ def test_project_stats(self):
self.testapp.get('/project/%d/stats' % project_id,
status=200, xhr=True)

def test_project__archive_allowed(self):
import transaction
from osmtm.models import Project, DBSession
project_id = self.create_project()

project = DBSession.query(Project).get(project_id)
project.status = Project.status_archived
DBSession.add(project)
DBSession.flush()
transaction.commit()

headers_pm = self.login_as_project_manager()
self.testapp.get('/project/%d' % project_id,
status=200,
headers=headers_pm)

headers_admin = self.login_as_admin()
self.testapp.get('/project/%d' % project_id,
status=200,
headers=headers_admin)

def test_project__private_not_allowed(self):
import transaction
from osmtm.models import Project, DBSession
Expand Down Expand Up @@ -602,33 +581,6 @@ def test_project__draft_not_allowed(self):
status=403,
headers=headers_user1)

def test_project__archive_not_allowed(self):
import transaction
from . import USER1_ID
from osmtm.models import User, Project, DBSession
project_id = self.create_project()

project = DBSession.query(Project).get(project_id)
project.status = Project.status_archived
DBSession.add(project)
DBSession.flush()
transaction.commit()

headers_user1 = self.login_as_user1()
self.testapp.get('/project/%d' % project_id,
status=403,
headers=headers_user1)

user1 = DBSession.query(User).get(USER1_ID)
project = DBSession.query(Project).get(project_id)
project.allowed_users.append(user1)
DBSession.add(project)
DBSession.flush()
transaction.commit()
self.testapp.get('/project/%d' % project_id,
status=403,
headers=headers_user1)

def test_home__private_not_allowed(self):
import transaction
from . import USER1_ID
Expand Down

0 comments on commit d3112e5

Please sign in to comment.