Skip to content

Commit

Permalink
Add proxy authentification type
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Oct 18, 2017
1 parent ae7b759 commit 2a1fae6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions commons/c2cgeoportal_commons/models/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ def __init__(
OGCSERVER_AUTH_NOAUTH = "No auth"
OGCSERVER_AUTH_STANDARD = "Standard auth"
OGCSERVER_AUTH_GEOSERVER = "Geoserver auth"
OGCSERVER_AUTH_PROXY = "Proxy"


class OGCServer(Base):
Expand Down Expand Up @@ -550,6 +551,7 @@ class OGCServer(Base):
OGCSERVER_AUTH_NOAUTH,
OGCSERVER_AUTH_STANDARD,
OGCSERVER_AUTH_GEOSERVER,
OGCSERVER_AUTH_PROXY,
native_enum=False), nullable=False)
wfs_support = Column(Boolean)
is_single_tile = Column(Boolean)
Expand Down
11 changes: 6 additions & 5 deletions geoportal/c2cgeoportal_geoportal/views/mapserverproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from c2cgeoportal_geoportal.lib.functionality import get_mapserver_substitution_params
from c2cgeoportal_geoportal.lib.filter_capabilities import filter_capabilities
from c2cgeoportal_geoportal.views.ogcproxy import OGCProxy
from c2cgeoportal_commons.models.main import OGCSERVER_AUTH_GEOSERVER
from c2cgeoportal_commons.models.main import OGCSERVER_AUTH_GEOSERVER, OGCSERVER_AUTH_STANDARD

cache_region = get_region()
log = logging.getLogger(__name__)
Expand All @@ -62,11 +62,12 @@ def proxy(self):

role = self.user.role
if role is not None:
self.params["role_id"] = role.id
if self._get_ogc_server().auth == OGCSERVER_AUTH_STANDARD:
self.params["role_id"] = role.id

# In some application we want to display the features owned by a user
# than we need his id.
self.params["user_id"] = self.user.id # pragma: no cover
# In some application we want to display the features owned by a user
# than we need his id.
self.params["user_id"] = self.user.id # pragma: no cover
else: # pragma nocover
log.warning("The user '%s' has no role", self.user.name)

Expand Down

0 comments on commit 2a1fae6

Please sign in to comment.