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

Add proxy authentification type #3181

Merged
merged 1 commit into from
Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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