Skip to content

Commit

Permalink
RSS feeds access (datopian#5)
Browse files Browse the repository at this point in the history
* [exception][xs] Make exception for RSS feeds

* [fix][xs] Fix typo error and remove .atom

* [fix][xs] Fix typo error

* Added startswith('/feeds/')
  • Loading branch information
gavram authored Nov 27, 2020
1 parent e63dd91 commit f880c97
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckanext/noanonaccess/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def __call__(self, environ, start_response):
if catalog_endpoint:
catalog_endpoint = catalog_endpoint.split('/{_format}')
catalog_endpoints.append(catalog_endpoint[0])
# Get feeds_access variable from the config object
feeds_access = config.get('ckanext.noanonaccess.allow_feeds')
# we putting only UI behind login so API paths should remain accessible
# also, allow access to dataset download and uploaded files
if '/api/' in environ['PATH_INFO'] or '/datastore/dump/' in environ['PATH_INFO']:
Expand All @@ -39,6 +41,10 @@ def __call__(self, environ, start_response):
# If dcat_acess is enabled in the .env file make dataset and
# catalog pages accessible
return self.app(environ,start_response)
elif feeds_access and environ['PATH_INFO'].startswith('/feeds/'):
# If feeds_acess is enabled in the .env file
# make RSS feeds page accessible
return self.app(environ,start_response)
else:
# otherwise only login/reset are accessible
if (environ['PATH_INFO'] == '/user/login' or environ['PATH_INFO'] == '/user/_logout'
Expand Down

0 comments on commit f880c97

Please sign in to comment.