Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
4ee29605
Commit
4ee29605
authored
11 years ago
by
Arthur Schiwon
Browse files
Options
Downloads
Patches
Plain Diff
LDAP Wizard: introduce configuration status indicator, fixes #5741
parent
15c4e4ed
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/user_ldap/css/settings.css
+15
-1
15 additions, 1 deletion
apps/user_ldap/css/settings.css
apps/user_ldap/js/settings.js
+69
-21
69 additions, 21 deletions
apps/user_ldap/js/settings.js
apps/user_ldap/templates/part.wizardcontrols.php
+2
-0
2 additions, 0 deletions
apps/user_ldap/templates/part.wizardcontrols.php
with
86 additions
and
22 deletions
apps/user_ldap/css/settings.css
+
15
−
1
View file @
4ee29605
...
@@ -109,3 +109,17 @@ select[multiple=multiple] + button {
...
@@ -109,3 +109,17 @@ select[multiple=multiple] + button {
min-width
:
40%
;
min-width
:
40%
;
max-width
:
40%
;
max-width
:
40%
;
}
}
.ldap_config_state_indicator_sign
{
display
:
inline-block
;
height
:
16px
;
width
:
16px
;
vertical-align
:
text-bottom
;
}
.ldap_config_state_indicator_sign.success
{
background
:
#37ce02
;
border-radius
:
8px
;
}
.ldap_config_state_indicator_sign.error
{
background
:
#ce3702
;
}
This diff is collapsed.
Click to expand it.
apps/user_ldap/js/settings.js
+
69
−
21
View file @
4ee29605
...
@@ -103,6 +103,20 @@ var LdapConfiguration = {
...
@@ -103,6 +103,20 @@ var LdapConfiguration = {
);
);
},
},
testConfiguration
:
function
(
onSuccess
,
onError
)
{
$
.
post
(
OC
.
filePath
(
'
user_ldap
'
,
'
ajax
'
,
'
testConfiguration.php
'
),
$
(
'
#ldap
'
).
serialize
(),
function
(
result
)
{
if
(
result
.
status
===
'
success
'
)
{
onSuccess
(
result
);
}
else
{
onError
(
result
);
}
}
);
},
clearMappings
:
function
(
mappingSubject
)
{
clearMappings
:
function
(
mappingSubject
)
{
$
.
post
(
$
.
post
(
OC
.
filePath
(
'
user_ldap
'
,
'
ajax
'
,
'
clearMappings.php
'
),
OC
.
filePath
(
'
user_ldap
'
,
'
ajax
'
,
'
clearMappings.php
'
),
...
@@ -187,6 +201,7 @@ var LdapWizard = {
...
@@ -187,6 +201,7 @@ var LdapWizard = {
user
=
$
(
'
#ldap_dn
'
).
val
();
user
=
$
(
'
#ldap_dn
'
).
val
();
pass
=
$
(
'
#ldap_agent_password
'
).
val
();
pass
=
$
(
'
#ldap_agent_password
'
).
val
();
//FIXME: determine base dn with anonymous access
if
(
host
&&
port
&&
user
&&
pass
)
{
if
(
host
&&
port
&&
user
&&
pass
)
{
param
=
'
action=guessBaseDN
'
+
param
=
'
action=guessBaseDN
'
+
'
&ldap_serverconfig_chooser=
'
+
$
(
'
#ldap_serverconfig_chooser
'
).
val
();
'
&ldap_serverconfig_chooser=
'
+
$
(
'
#ldap_serverconfig_chooser
'
).
val
();
...
@@ -205,7 +220,7 @@ var LdapWizard = {
...
@@ -205,7 +220,7 @@ var LdapWizard = {
function
(
result
)
{
function
(
result
)
{
LdapWizard
.
hideSpinner
(
'
#ldap_base
'
);
LdapWizard
.
hideSpinner
(
'
#ldap_base
'
);
LdapWizard
.
showInfoBox
(
'
Please specify a Base DN
'
);
LdapWizard
.
showInfoBox
(
'
Please specify a Base DN
'
);
$
(
'
#ldap_base
'
).
prop
(
'
disabled
'
,
false
);
LdapWizard
.
showInfoBox
(
'
Could not determine Base DN
'
);
}
}
);
);
}
}
...
@@ -234,7 +249,7 @@ var LdapWizard = {
...
@@ -234,7 +249,7 @@ var LdapWizard = {
function
(
result
)
{
function
(
result
)
{
LdapWizard
.
hideSpinner
(
'
#ldap_port
'
);
LdapWizard
.
hideSpinner
(
'
#ldap_port
'
);
$
(
'
#ldap_port
'
).
prop
(
'
disabled
'
,
false
);
$
(
'
#ldap_port
'
).
prop
(
'
disabled
'
,
false
);
LdapWizard
.
showInfoBox
(
'
Please specify the
P
ort
'
);
LdapWizard
.
showInfoBox
(
'
Please specify the
p
ort
'
);
}
}
);
);
}
}
...
@@ -428,14 +443,16 @@ var LdapWizard = {
...
@@ -428,14 +443,16 @@ var LdapWizard = {
functionalityCheck
:
function
()
{
functionalityCheck
:
function
()
{
//criterias to enable the connection:
//criterias to enable the connection:
// - host, port, user filter, login filter
// - host, port,
basedn,
user filter, login filter
host
=
$
(
'
#ldap_host
'
).
val
();
host
=
$
(
'
#ldap_host
'
).
val
();
port
=
$
(
'
#ldap_port
'
).
val
();
port
=
$
(
'
#ldap_port
'
).
val
();
userfilter
=
$
(
'
#ldap_dn
'
).
val
();
base
=
$
(
'
#ldap_base
'
).
val
();
loginfilter
=
$
(
'
#ldap_agent_password
'
).
val
();
userfilter
=
$
(
'
#ldap_userlist_filter
'
).
val
();
loginfilter
=
$
(
'
#ldap_login_filter
'
).
val
();
//FIXME: activates a manually deactivated configuration.
//FIXME: activates a manually deactivated configuration.
if
(
host
&&
port
&&
userfilter
&&
loginfilter
)
{
if
(
host
&&
port
&&
base
&&
userfilter
&&
loginfilter
)
{
LdapWizard
.
updateStatusIndicator
(
true
);
if
(
$
(
'
#ldap_configuration_active
'
).
is
(
'
:checked
'
))
{
if
(
$
(
'
#ldap_configuration_active
'
).
is
(
'
:checked
'
))
{
return
;
return
;
}
}
...
@@ -446,6 +463,7 @@ var LdapWizard = {
...
@@ -446,6 +463,7 @@ var LdapWizard = {
$
(
'
#ldap_configuration_active
'
).
prop
(
'
checked
'
,
false
);
$
(
'
#ldap_configuration_active
'
).
prop
(
'
checked
'
,
false
);
LdapWizard
.
save
(
$
(
'
#ldap_configuration_active
'
)[
0
]);
LdapWizard
.
save
(
$
(
'
#ldap_configuration_active
'
)[
0
]);
}
}
LdapWizard
.
updateStatusIndicator
(
false
);
}
}
},
},
...
@@ -463,6 +481,7 @@ var LdapWizard = {
...
@@ -463,6 +481,7 @@ var LdapWizard = {
init
:
function
()
{
init
:
function
()
{
LdapWizard
.
basicStatusCheck
();
LdapWizard
.
basicStatusCheck
();
LdapWizard
.
functionalityCheck
();
},
},
initGroupFilter
:
function
()
{
initGroupFilter
:
function
()
{
...
@@ -543,6 +562,7 @@ var LdapWizard = {
...
@@ -543,6 +562,7 @@ var LdapWizard = {
if
(
$
(
'
#ldapSettings
'
).
tabs
(
'
option
'
,
'
active
'
)
==
0
)
{
if
(
$
(
'
#ldapSettings
'
).
tabs
(
'
option
'
,
'
active
'
)
==
0
)
{
LdapWizard
.
basicStatusCheck
();
LdapWizard
.
basicStatusCheck
();
LdapWizard
.
functionalityCheck
();
}
}
},
},
...
@@ -643,6 +663,35 @@ var LdapWizard = {
...
@@ -643,6 +663,35 @@ var LdapWizard = {
'
#ldap_userfilter_groups
'
,
'
#ldap_userfilter_groups
'
,
'
userFilterGroupSelectState
'
'
userFilterGroupSelectState
'
);
);
},
updateStatusIndicator
:
function
(
isComplete
)
{
if
(
isComplete
)
{
LdapConfiguration
.
testConfiguration
(
//onSuccess
function
(
result
)
{
$
(
'
.ldap_config_state_indicator
'
).
text
(
t
(
'
user_ldap
'
,
'
Configuration OK
'
));
$
(
'
.ldap_config_state_indicator_sign
'
).
removeClass
(
'
error
'
);
$
(
'
.ldap_config_state_indicator_sign
'
).
addClass
(
'
success
'
);
},
//onError
function
(
result
)
{
$
(
'
.ldap_config_state_indicator
'
).
text
(
t
(
'
user_ldap
'
,
'
Configuration incorrect
'
));
$
(
'
.ldap_config_state_indicator_sign
'
).
addClass
(
'
error
'
);
$
(
'
.ldap_config_state_indicator_sign
'
).
removeClass
(
'
success
'
);
}
);
}
else
{
$
(
'
.ldap_config_state_indicator
'
).
text
(
t
(
'
user_ldap
'
,
'
Configuration incomplete
'
));
$
(
'
.ldap_config_state_indicator_sign
'
).
removeClass
(
'
error
'
);
$
(
'
.ldap_config_state_indicator_sign
'
).
removeClass
(
'
success
'
);
}
}
}
};
};
...
@@ -681,22 +730,21 @@ $(document).ready(function() {
...
@@ -681,22 +730,21 @@ $(document).ready(function() {
});
});
$
(
'
.ldap_action_test_connection
'
).
click
(
function
(
event
){
$
(
'
.ldap_action_test_connection
'
).
click
(
function
(
event
){
event
.
preventDefault
();
event
.
preventDefault
();
$
.
post
(
LdapConfiguration
.
testConfiguration
(
OC
.
filePath
(
'
user_ldap
'
,
'
ajax
'
,
'
testConfiguration.php
'
),
//onSuccess
$
(
'
#ldap
'
).
serialize
(),
function
(
result
)
{
function
(
result
)
{
if
(
result
.
status
===
'
success
'
)
{
OC
.
dialogs
.
alert
(
OC
.
dialogs
.
alert
(
result
.
message
,
result
.
message
,
t
(
'
user_ldap
'
,
'
Connection test succeeded
'
)
t
(
'
user_ldap
'
,
'
Connection test succeeded
'
)
);
);
}
else
{
},
//onError
function
(
result
)
{
OC
.
dialogs
.
alert
(
OC
.
dialogs
.
alert
(
result
.
message
,
result
.
message
,
t
(
'
user_ldap
'
,
'
Connection test failed
'
)
t
(
'
user_ldap
'
,
'
Connection test failed
'
)
);
);
}
}
}
);
);
});
});
...
...
This diff is collapsed.
Click to expand it.
apps/user_ldap/templates/part.wizardcontrols.php
+
2
−
0
View file @
4ee29605
...
@@ -12,4 +12,6 @@
...
@@ -12,4 +12,6 @@
style=
"height:1.75ex"
/>
style=
"height:1.75ex"
/>
<?php
p
(
$l
->
t
(
'Help'
));
?>
<?php
p
(
$l
->
t
(
'Help'
));
?>
</a>
</a>
<br/>
<span
class=
"ldap_config_state_indicator"
></span>
<span
class=
"ldap_config_state_indicator_sign"
></span>
</div>
</div>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment