make sure $perms and $globalPerms have the right keys
authorjean-gui@barbossa
Mon, 04 Jul 2011 10:52:28 +0200
changeset 3 a3402c9d9582
parent 2 4bd33c66976f
child 4 ffa45c5c9dd1
make sure $perms and $globalPerms have the right keys
wordpress_ldap_plugin/ldap_roles/lib/ldap_roles.php
--- a/wordpress_ldap_plugin/ldap_roles/lib/ldap_roles.php	Fri Jul 01 18:35:15 2011 +0200
+++ b/wordpress_ldap_plugin/ldap_roles/lib/ldap_roles.php	Mon Jul 04 10:52:28 2011 +0200
@@ -69,7 +69,8 @@
 function updateBlogUserRoles($blog_id, $user_id, $user_groups, $perms, $globalPerms, $priorities) {
     if($priorities && $perms) {
         foreach($priorities as $priority => $roleKey) {
-            if(($perms && in_array('*', $perms[$roleKey])) || ($globalPerms && in_array('*', $globalPerms[$roleKey]))) {
+            if(($perms && array_key_exists($roleKey, $perms) && in_array('*', $perms[$roleKey])) || 
+               ($globalPerms && array_key_exists($roleKey, $globalPerms) && in_array('*', $globalPerms[$roleKey]))) {
                 wpmuLdapAddUserToBlog($user_id, $blog_id, $roleKey);
                 return true;
             }
@@ -77,8 +78,8 @@
                 
                 $group_dn = strtolower($g[get_site_option('ldapAttributeDN',LDAP_DEFAULT_ATTRIBUTE_DN)]);
                 if($group_dn && 
-                   (($perms[$roleKey] && in_array($group_dn, $perms[$roleKey]) || 
-                     ($globalPerms[$roleKey] && in_array($group_dn, $globalPerms[$roleKey]))))) {
+                   (($perms && array_key_exists($roleKey, $perms) && in_array($group_dn, $perms[$roleKey]) || 
+                     ($globalPerms && array_key_exists($roleKey, $globalPerms) && in_array($group_dn, $globalPerms[$roleKey]))))) {
                     wpmuLdapAddUserToBlog($user_id, $blog_id, $roleKey);
                     return true;
                 }