Use !== and === in user_ldap app – Part 1
This commit is contained in:
parent
ec280e6f9f
commit
b8fe7025da
|
@ -24,7 +24,7 @@
|
|||
OCP\App::registerAdmin('user_ldap', 'settings');
|
||||
|
||||
$configPrefixes = OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(true);
|
||||
if(count($configPrefixes) == 1) {
|
||||
if(count($configPrefixes) === 1) {
|
||||
$connector = new OCA\user_ldap\lib\Connection($configPrefixes[0]);
|
||||
$userBackend = new OCA\user_ldap\USER_LDAP();
|
||||
$userBackend->setConnector($connector);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doSet');
|
||||
if($state == 'doSet') {
|
||||
if($state === 'doSet') {
|
||||
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ if(!is_null($pw)) {
|
|||
//detect if we can switch on naming guidelines. We won't do it on conflicts.
|
||||
//it's a bit spaghetti, but hey.
|
||||
$state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'unset');
|
||||
if($state == 'unset') {
|
||||
if($state === 'unset') {
|
||||
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ foreach($objects as $object) {
|
|||
$newDN = escapeDN(mb_strtolower($dn['ldap_dn'], 'UTF-8'));
|
||||
if(!empty($dn['directory_uuid'])) {
|
||||
$uuid = $dn['directory_uuid'];
|
||||
} elseif($object == 'user') {
|
||||
} elseif($object === 'user') {
|
||||
$uuid = $userBE->getUUID($newDN);
|
||||
//fix home folder to avoid new ones depending on the configuration
|
||||
$userBE->getHome($dn['owncloud_name']);
|
||||
|
|
|
@ -66,7 +66,7 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
|||
|
||||
//extra work if we don't get back user DNs
|
||||
//TODO: this can be done with one LDAP query
|
||||
if(strtolower($this->connection->ldapGroupMemberAssocAttr) == 'memberuid') {
|
||||
if(strtolower($this->connection->ldapGroupMemberAssocAttr) === 'memberuid') {
|
||||
$dns = array();
|
||||
foreach($members as $mid) {
|
||||
$filter = str_replace('%uid', $mid, $this->connection->ldapLoginFilter);
|
||||
|
@ -108,11 +108,11 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
|||
}
|
||||
|
||||
//uniqueMember takes DN, memberuid the uid, so we need to distinguish
|
||||
if((strtolower($this->connection->ldapGroupMemberAssocAttr) == 'uniquemember')
|
||||
|| (strtolower($this->connection->ldapGroupMemberAssocAttr) == 'member')
|
||||
if((strtolower($this->connection->ldapGroupMemberAssocAttr) === 'uniquemember')
|
||||
|| (strtolower($this->connection->ldapGroupMemberAssocAttr) === 'member')
|
||||
) {
|
||||
$uid = $userDN;
|
||||
} else if(strtolower($this->connection->ldapGroupMemberAssocAttr) == 'memberuid') {
|
||||
} else if(strtolower($this->connection->ldapGroupMemberAssocAttr) === 'memberuid') {
|
||||
$result = $this->readAttribute($userDN, 'uid');
|
||||
$uid = $result[0];
|
||||
} else {
|
||||
|
@ -157,7 +157,7 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
|||
return $groupUsers;
|
||||
}
|
||||
|
||||
if($limit == -1) {
|
||||
if($limit === -1) {
|
||||
$limit = null;
|
||||
}
|
||||
$groupDN = $this->groupname2dn($gid);
|
||||
|
@ -175,7 +175,7 @@ class GROUP_LDAP extends lib\Access implements \OCP\GroupInterface {
|
|||
}
|
||||
|
||||
$groupUsers = array();
|
||||
$isMemberUid = (strtolower($this->connection->ldapGroupMemberAssocAttr) == 'memberuid');
|
||||
$isMemberUid = (strtolower($this->connection->ldapGroupMemberAssocAttr) === 'memberuid');
|
||||
foreach($members as $member) {
|
||||
if($isMemberUid) {
|
||||
//we got uids, need to get their DNs to 'tranlsate' them to usernames
|
||||
|
|
|
@ -8,13 +8,13 @@ var LdapConfiguration = {
|
|||
OC.filePath('user_ldap','ajax','getConfiguration.php'),
|
||||
$('#ldap_serverconfig_chooser').serialize(),
|
||||
function (result) {
|
||||
if(result.status == 'success') {
|
||||
if(result.status === 'success') {
|
||||
$.each(result.configuration, function(configkey, configvalue) {
|
||||
elementID = '#'+configkey;
|
||||
|
||||
//deal with Checkboxes
|
||||
if($(elementID).is('input[type=checkbox]')) {
|
||||
if(configvalue == 1) {
|
||||
if(configvalue === 1) {
|
||||
$(elementID).attr('checked', 'checked');
|
||||
} else {
|
||||
$(elementID).removeAttr('checked');
|
||||
|
@ -37,13 +37,13 @@ var LdapConfiguration = {
|
|||
|
||||
resetDefaults: function() {
|
||||
$('#ldap').find('input[type=text], input[type=number], input[type=password], textarea, select').each(function() {
|
||||
if($(this).attr('id') == 'ldap_serverconfig_chooser') {
|
||||
if($(this).attr('id') === 'ldap_serverconfig_chooser') {
|
||||
return;
|
||||
}
|
||||
$(this).val($(this).attr('data-default'));
|
||||
});
|
||||
$('#ldap').find('input[type=checkbox]').each(function() {
|
||||
if($(this).attr('data-default') == 1) {
|
||||
if($(this).attr('data-default') === 1) {
|
||||
$(this).attr('checked', 'checked');
|
||||
} else {
|
||||
$(this).removeAttr('checked');
|
||||
|
@ -56,7 +56,7 @@ var LdapConfiguration = {
|
|||
OC.filePath('user_ldap','ajax','deleteConfiguration.php'),
|
||||
$('#ldap_serverconfig_chooser').serialize(),
|
||||
function (result) {
|
||||
if(result.status == 'success') {
|
||||
if(result.status === 'success') {
|
||||
$('#ldap_serverconfig_chooser option:selected').remove();
|
||||
$('#ldap_serverconfig_chooser option:first').select();
|
||||
LdapConfiguration.refreshConfig();
|
||||
|
@ -74,7 +74,7 @@ var LdapConfiguration = {
|
|||
$.post(
|
||||
OC.filePath('user_ldap','ajax','getNewServerConfigPrefix.php'),
|
||||
function (result) {
|
||||
if(result.status == 'success') {
|
||||
if(result.status === 'success') {
|
||||
if(doNotAsk) {
|
||||
LdapConfiguration.resetDefaults();
|
||||
} else {
|
||||
|
@ -115,7 +115,7 @@ $(document).ready(function() {
|
|||
OC.filePath('user_ldap','ajax','testConfiguration.php'),
|
||||
$('#ldap').serialize(),
|
||||
function (result) {
|
||||
if (result.status == 'success') {
|
||||
if (result.status === 'success') {
|
||||
OC.dialogs.alert(
|
||||
result.message,
|
||||
t('user_ldap', 'Connection test succeeded')
|
||||
|
@ -150,7 +150,7 @@ $(document).ready(function() {
|
|||
$('#ldap').serialize(),
|
||||
function (result) {
|
||||
bgcolor = $('#ldap_submit').css('background');
|
||||
if (result.status == 'success') {
|
||||
if (result.status === 'success') {
|
||||
//the dealing with colors is a but ugly, but the jQuery version in use has issues with rgba colors
|
||||
$('#ldap_submit').css('background', '#fff');
|
||||
$('#ldap_submit').effect('highlight', {'color':'#A8FA87'}, 5000, function() {
|
||||
|
@ -168,7 +168,7 @@ $(document).ready(function() {
|
|||
|
||||
$('#ldap_serverconfig_chooser').change(function(event) {
|
||||
value = $('#ldap_serverconfig_chooser option:selected:first').attr('value');
|
||||
if(value == 'NEW') {
|
||||
if(value === 'NEW') {
|
||||
LdapConfiguration.addConfiguration(false);
|
||||
} else {
|
||||
LdapConfiguration.refreshConfig();
|
||||
|
|
Loading…
Reference in New Issue