Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
11300809
Commit
11300809
authored
Nov 15, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
impersonate
parent
492dc574
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
225 additions
and
196 deletions
+225
-196
settings.py
GeoInt_SIDT/settings.py
+3
-0
urls.py
GeoInt_SIDT/urls.py
+1
-0
users_table.html
administration/templates/users_table.html
+4
-0
middleware.py
catalog/middleware.py
+6
-0
base_top.html
catalog/templates/base_top.html
+203
-190
minimap.js
reports/static/reports/js/minimap.js
+5
-3
views.py
reports/views.py
+3
-3
No files found.
GeoInt_SIDT/settings.py
View file @
11300809
...
...
@@ -45,6 +45,7 @@ INSTALLED_APPS = [
'administration.apps.AdministrationConfig'
,
'users.apps.UsersConfig'
,
'django_extensions'
,
'impersonate'
]
MIDDLEWARE
=
[
...
...
@@ -53,9 +54,11 @@ MIDDLEWARE = [
'django.middleware.common.CommonMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'impersonate.middleware.ImpersonateMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
'django.middleware.clickjacking.XFrameOptionsMiddleware'
,
'catalog.middleware.AuthRequiredMiddleware'
,
]
ROOT_URLCONF
=
'GeoInt_SIDT.urls'
...
...
GeoInt_SIDT/urls.py
View file @
11300809
...
...
@@ -31,5 +31,6 @@ urlpatterns = [
url
(
r'^mail/'
,
include
(
'mail.urls'
)),
url
(
r'^administration/'
,
include
(
'administration.urls'
)),
url
(
r'^users/'
,
include
(
'users.urls'
)),
url
(
r'^impersonate/'
,
include
(
'impersonate.urls'
)),
]
# + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
administration/templates/users_table.html
View file @
11300809
...
...
@@ -164,6 +164,10 @@
{%
if
user
.
superuser =
=
True
%}
checked
{%
endif
%}
>
</td>
<td>
{% if not user.superuser and request.user.is_superuser %}
<a
title=
"swithc user"
href=
"{% url 'impersonate-start' user.user_id %}"
class=
"btn btn-warning"
><i
class=
"fa fa-eye"
></i></a>
{% endif %}
<button
title=
"save"
type=
"submit"
class=
"btn btn-success"
><i
class=
"fa fa-save"
></i></button>
{% if Viewname != "Request" %}
...
...
catalog/middleware.py
View file @
11300809
...
...
@@ -15,6 +15,7 @@ class AuthRequiredMiddleware(object):
# the view (and later middleware) are called.
response
=
self
.
get_response
(
request
)
print
(
'midleware response'
,
response
)
if
"/reports/"
in
request
.
path_info
and
not
request
.
user
.
is_authenticated
:
...
...
@@ -33,12 +34,17 @@ class AuthRequiredMiddleware(object):
#elif not request.user.is_authenticated and request.path_info == reverse('tile') or request.path_info == reverse('tileinfo') :
# return response
elif
"/impersonate/"
in
request
.
path_info
:
return
response
elif
request
.
path_info
==
reverse
(
'ipn'
):
return
response
elif
not
request
.
user
.
is_authenticated
and
request
.
path_info
!=
reverse
(
'login'
)
and
not
request
.
user
.
is_active
:
return
HttpResponseRedirect
(
reverse
(
'login'
))
# Code to be executed for each request/response after
# the view is called.
print
(
'user'
,
request
.
user
)
return
response
catalog/templates/base_top.html
View file @
11300809
This diff is collapsed.
Click to expand it.
reports/static/reports/js/minimap.js
View file @
11300809
MAPBOX_ACCESS_TOKEN
=
'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw'
;
MAX_OPACITY
=
1
;
FIRST_IMAGE_LAYER_INDEX
=
2
;
document
.
getElementById
(
"light"
).
checked
=
true
;
// create wkt polygon
const
wktFormat
=
new
ol
.
format
.
WKT
();
...
...
@@ -79,6 +79,8 @@ else {
x
=
'light'
;
//console.log({x})
}
document
.
getElementById
(
x
).
checked
=
true
;
const
polygonLayer
=
new
ol
.
layer
.
Vector
({
name
:
'polygon'
,
source
:
new
ol
.
source
.
Vector
({
...
...
@@ -207,7 +209,7 @@ function changeLayers(especific_layerName) {
}
layers
.
set
(
layerName
,
xyz
);
sessionStorage
.
setItem
(
layerName
,
layerName
);
// replace
sessionStorage
.
setItem
(
layerName
,
layerName
);
});
}
...
...
@@ -223,7 +225,7 @@ function removeLayer(layerName) {
map
.
removeLayer
(
layers
.
get
(
layerName
));
layers
.
delete
(
layerName
);
sessionStorage
.
layers
=
layers
;
sessionStorage
.
removeItem
(
layerName
)
}
// set opacity to layers
...
...
reports/views.py
View file @
11300809
...
...
@@ -208,9 +208,9 @@ def Reports(request):
for
file
in
os
.
listdir
(
zip_path
):
if
file
.
endswith
(
".zip"
):
zip
=
zip_path
+
"/"
+
file
if
os
.
path
.
getsize
(
USERS_PATH
+
producto
[
'user__email'
]
+
"/"
+
str
(
producto
[
'id'
])
+
"/scl_data.json"
)
>
3
:
Data
=
True
if
os
.
path
.
exists
(
USERS_PATH
+
producto
[
'user__email'
]
+
'/'
+
str
(
producto
[
'id'
])
+
'/scl_data.json'
):
if
os
.
path
.
getsize
(
USERS_PATH
+
producto
[
'user__email'
]
+
"/"
+
str
(
producto
[
'id'
])
+
"/scl_data.json"
)
>
3
:
Data
=
True
productList
.
append
({
"search_name"
:
producto
[
'name'
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment