Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
technical:api-pu-disable [2025/04/13 09:32] systemtechnical:api-pu-disable [2025/04/13 15:13] (current) system
Line 7: Line 7:
  
 ====== Enable and Disable Permanent Users ====== ====== Enable and Disable Permanent Users ======
 +<alert type="warning">
 +  * RADIUSdesk includes a component called 'ISP-Plumbing' which needs to be configured first.
 +  * When this component is configured, any active sessions for a user will be terminated upon the completion of the enable or disable action.
 +  * This comes in handy to move a user into or out of an isolation VLAN or network.
 +</alert>
   * To enable or disable a Permanent User we have to first determine the id of the Permanent User.   * To enable or disable a Permanent User we have to first determine the id of the Permanent User.
   * A CRM system typically do not know the id of the Permanent User in RADIUSdesk.   * A CRM system typically do not know the id of the Permanent User in RADIUSdesk.
Line 22: Line 27:
          
     $username   = 'testuser@dev';     $username   = 'testuser@dev';
-    $action     = 'enable'; //Options 'enable' or 'disable'+    $action     = 'disable'; //Options 'enable' or 'disable'
          
     // Filter settings     // Filter settings
Line 29: Line 34:
     $value      = $username; //can also be set to boolean e.g. true or false to filter for instance on the 'active' field     $value      = $username; //can also be set to boolean e.g. true or false to filter for instance on the 'active' field
     $limit      = 1000;     $limit      = 1000;
-    +     
-    $find_url   = "$server/cake4/rd_cake/permanent-users/index.json?page=1&start=0&limit=$limit&filter=[{%22operator%22%3A%22$operator%22%2C%22value%22%3A%22".$value."%22%2C%22property%22%3A%22$filter%22}]&token=$token&cloud_id=$cloud_id";+    $filter_array = [ 
 +        [ 
 +            "operator" => $operator, 
 +            "value"    => $value, // this stays a boolean! 
 +            "property" => $filter 
 +        ] 
 +    ]; 
 + 
 +    $encoded_filter = urlencode(json_encode($filter_array)); 
 + 
 +    $find_url = "$server/cake4/rd_cake/permanent-users/index.json?page=1&start=0&limit=$limit&filter=$encoded_filter&token=$token&cloud_id=$cloud_id";
          
    
Line 63: Line 78:
      ]      ]
      ]);      ]);
 +     
 +     print($find_url);
  
      // Get the response      // Get the response
Line 81: Line 98:
                 $listOfIds[$id] = $id;                     $listOfIds[$id] = $id;    
             }             }
-            echo "There $count items!";+            echo "There $count items\n";
             return $listOfIds;             return $listOfIds;
         } else {         } else {
Line 88: Line 105:
      return false;      return false;
     }     }
- +     
 ?> ?>
 </file> </file>
Line 113: Line 130:
 $limit      = 1000; $limit      = 1000;
 </code> </code>
- 
- 
  • technical/api-pu-disable.1744529568.txt.gz
  • Last modified: 2025/04/13 09:32
  • by system