Profile_User::deleteRights PHP Method

deleteRights() static public method

static public deleteRights ( $user_ID, $only_dynamic = false )
$user_ID
$only_dynamic (false by default)
    static function deleteRights($user_ID, $only_dynamic = false)
    {
        $crit['users_id'] = $user_ID;
        if ($only_dynamic) {
            $crit['is_dynamic'] = '1';
        }
        $obj = new self();
        $obj->deleteByCriteria($crit);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param $users_id
  **/
 static function manageDeletedUserInLdap($users_id)
 {
     global $CFG_GLPI;
     //User is present in DB but not in the directory : it's been deleted in LDAP
     $tmp['id'] = $users_id;
     $myuser = new User();
     switch ($CFG_GLPI['user_deleted_ldap']) {
         //DO nothing
         default:
         case 0:
             break;
             //Put user in dustbin
         //Put user in dustbin
         case 1:
             $myuser->delete($tmp);
             break;
             //Delete all user dynamic habilitations and groups
         //Delete all user dynamic habilitations and groups
         case 2:
             Profile_User::deleteRights($users_id, true);
             Group_User::deleteGroups($users_id, true);
             break;
             //Deactivate the user
         //Deactivate the user
         case 3:
             $tmp['is_active'] = 0;
             $myuser->update($tmp);
             break;
     }
     $changes[0] = '0';
     $changes[1] = '';
     $changes[2] = __('Deleted user in LDAP directory');
     Log::history($users_id, 'User', $changes, 0, Log::HISTORY_LOG_SIMPLE_MESSAGE);
 }
All Usage Examples Of Profile_User::deleteRights