Gitlab CSE Unil
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
ADIM
Commits
b3f036f1
Commit
b3f036f1
authored
Apr 17, 2015
by
Julien Furrer
Browse files
Added support for Shibboleth SLO
Not activated by default
parent
c0ee5570
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
adim_app/static/_src/adim/config.js
View file @
b3f036f1
...
...
@@ -58,6 +58,13 @@ function($){
rateLimitWait
:
300
},
//// Uncomment to enable Shibboleth SLO
//aai : {
// sp_logout: "https://jabba.unil.ch/Shibboleth.sso/Logout",
// idp_logout: "https://aai.unil.ch/idp/logout.jsp"
//},
// ====================================================================
// ----- Specific config
// The following settings are specific to the current use of the tool
...
...
adim_app/static/_src/adim/ui.js
View file @
b3f036f1
...
...
@@ -82,7 +82,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
* - document is ready
* - view.js is initialized
*
* @param
mainEvent
s A dictionary of the signals dispatched by main.js
* @param
param
s A dictionary of the signals dispatched by main.js
* used to listen to the needed signals
*
*/
...
...
@@ -118,13 +118,13 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
// ----- General Event listeners -----
// Listen to events
view
.
events
.
imageLoaded
.
add
(
function
(
evt
)
{
view
.
events
.
imageLoaded
.
add
(
function
(
evt
)
{
adjustCanvasToImage
(
evt
.
raster
);
$
(
"
#page-loader
"
).
remove
();
console
.
timeEnd
(
"
complete app
"
);
});
view
.
events
.
annotationsLoaded
.
add
(
function
()
{
view
.
events
.
annotationsLoaded
.
add
(
function
()
{
zoomFitContent
();
updateUserLayers
();
_autoSave
=
true
;
...
...
@@ -134,7 +134,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
view
.
events
.
userLayerVisibilityChanged
.
add
(
onUserLayerVisChange
);
tools
.
events
.
annotationSelected
.
add
(
function
(
item
)
{
tools
.
events
.
annotationSelected
.
add
(
function
(
item
)
{
// ----- Update Properties Panel -----
// disable properties panel if there is no item or more than one
var
doDisplay
=
!!
item
&&
view
.
getSelectedAnnotations
().
length
===
1
;
...
...
@@ -147,7 +147,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
});
}*/
if
(
!
doDisplay
)
{
if
(
!
doDisplay
)
{
// Disable properties panel
disableProperties
(
true
);
$
(
"
*:focus
"
).
blur
();
...
...
@@ -173,7 +173,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
}
// -- color
var
itemColor
=
(
typeof
item
.
data
.
getColor
===
'
function
'
)
?
item
.
data
.
getColor
.
call
(
item
):
var
itemColor
=
(
typeof
item
.
data
.
getColor
===
'
function
'
)
?
item
.
data
.
getColor
.
call
(
item
)
:
(
item
.
data
.
color
)
?
item
.
data
.
color
:
(
item
.
strokeColor
)
?
item
.
strokeColor
:
item
.
fillColor
;
...
...
@@ -200,24 +200,26 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if
(
item
&&
item
.
layer
)
{
var
id
=
item
.
layer
.
id
;
var
annotationLayerListItem
=
$
(
"
#annotation-list-container .list-group-item
"
).
filter
(
function
(
i
,
n
){
return
(
$
(
n
).
data
(
'
layerId
'
)
==
id
);
}
function
(
i
,
n
)
{
return
(
$
(
n
).
data
(
'
layerId
'
)
==
id
);
}
);
selectLayerListItem
(
annotationLayerListItem
,
false
);
}
});
io
.
events
.
loadingError
.
add
(
function
(
err
){
io
.
events
.
loadingError
.
add
(
function
(
err
)
{
var
pageLoader
=
$
(
"
#page-loader
"
);
if
(
pageLoader
.
length
)
{
pageLoader
.
html
(
'
<div class="text-danger lead">Erreur de chargement</div>
'
+
'
<div class="text-danger lead">Erreur de chargement</div>
'
+
'
<div class="text-danger">
'
+
err
.
msg
+
'
</div>
'
);
}
else
{
var
alert
=
$
(
'
<div class="alert alert-danger in">
'
+
'
<button data-dismiss="alert" class="close" type="button">×</button>
'
+
'
<h4>Erreur de chargement</h4>
'
+
'
<p>
'
+
err
.
msg
+
'
</p>
'
+
var
alert
=
$
(
'
<div class="alert alert-danger in">
'
+
'
<button data-dismiss="alert" class="close" type="button">×</button>
'
+
'
<h4>Erreur de chargement</h4>
'
+
'
<p>
'
+
err
.
msg
+
'
</p>
'
+
'
</div>
'
);
...
...
@@ -225,6 +227,19 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
}
});
// AAI SLO
if
(
config
.
aai
&&
config
.
user
&&
config
.
user
.
shibboleth
)
{
$
(
"
#adim-logout-but
"
).
click
(
function
(
event
)
{
event
.
preventDefault
();
var
logout_url
=
$
(
this
).
attr
(
"
href
"
);
$
(
"
<iframe>
"
,
{
src
:
config
.
aai
.
sp_logout
}).
appendTo
(
"
body
"
).
hide
();
$
(
"
<iframe>
"
,
{
src
:
config
.
aai
.
idp_logout
}).
appendTo
(
"
body
"
).
hide
();
setTimeout
(
function
()
{
window
.
document
.
location
.
href
=
logout_url
;
},
500
);
});
}
var
_autoSave
=
io
.
getAutoSave
();
var
saveBut
=
$
(
"
#save-but
"
);
var
autoSaveBut
=
$
(
"
#autosave-but
"
);
...
...
adim_app/static/js/newao_app.min.js
View file @
b3f036f1
This diff is collapsed.
Click to expand it.
adim_app/static/js/su_app.min.js
View file @
b3f036f1
This diff is collapsed.
Click to expand it.
adim_app/templates/adim_app/annotation.html
View file @
b3f036f1
...
...
@@ -66,11 +66,12 @@ window.ADIM_CONFIG = {
username
:
"
{{ user.username }}
"
,
fullName
:
"
{{ user.get_full_name }}
"
,
full_name
:
"
{{ user.get_full_name }}
"
,
token
:
"
{{ user.auth_token }}
"
,
token
:
"
{{ user.auth_token }}
"
{
%
if
membership
%
}
membership
:
{
publish_mode
:
{{
membership
.
publish_mode
}}
}
,
,
membership
:
{
publish_mode
:
{{
membership
.
publish_mode
}}
}
{
%
endif
%
}
guest
:
{
%
if
anobj
.
owner
.
id
!=
user
.
id
%
}
true
{
%
else
%
}
false
{
%
endif
%
}
,
guest
:
{
%
if
anobj
.
owner
.
id
!=
user
.
id
%
}
true
{
%
else
%
}
false
{
%
endif
%
}
,
shibboleth
:
true
},
ui
:
{
...
...
adim_app/templates/adim_app/annotation_new.html
View file @
b3f036f1
...
...
@@ -32,6 +32,7 @@ window.ADIM_CONFIG = {
username
:
"
{{ user.username }}
"
,
fullName
:
"
{{ user.get_full_name }}
"
,
full_name
:
"
{{ user.get_full_name }}
"
,
shibboleth
:
true
},
ui
:
{
...
...
adim_app/templates/base.html
View file @
b3f036f1
...
...
@@ -37,7 +37,7 @@
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li
class=
"dropdown-header"
>
{{ user.username|default:user.email }}
</li>
<li
class=
"divider"
></li>
<li><a
href=
"{% url "
logout
"
%}"
><span
class=
"glyphicon glyphicon-log-out"
></span>
Déconnexion
</a></li>
<li><a
id=
"adim-logout-but"
href=
"{% url "
logout
"
%}"
><span
class=
"glyphicon glyphicon-log-out"
></span>
Déconnexion
</a></li>
</ul>
</li>
{% endif %}
...
...
adim_project/settings/components/auth.py
View file @
b3f036f1
...
...
@@ -6,7 +6,7 @@ AUTHENTICATION_BACKENDS = (
LOGIN_REDIRECT_URL
=
"adim.app:annotate_new"
LOGIN_URL
=
"adim.app:home"
SHIB_UID_ATTR
=
'
persistent-id
'
SHIB_UID_ATTR
=
'
uniqueID
'
SHIB_USERNAME_ATTR
=
'mail'
SHIB_ATTR_MAP
=
{
'user'
:
(
...
...
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