Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| technical:api-pu-disable [2025/04/13 09:08] – system | technical:api-pu-disable [2025/04/13 15:13] (current) – system | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| ----- | ----- | ||
| - | ====== Permanent Users ====== | + | ====== |
| - | * A **Permanent User** has to belong to a **Profile** and **Realm** in order to be useful to RADIUS. | + | <alert type=" |
| - | * In the previous Wiki Pages we already covered adding | + | * RADIUSdesk includes |
| - | * In this page we will show you how to add a Permanent User to a Cloud in RADIUSdesk | + | * When this component is configured, any active sessions for a user will be terminated upon the completion of the enable or disable action. |
| - | * We will use PHP but the principles can be applied using any programming language. | + | * This comes in handy to move a user into or out of an isolation VLAN or network. |
| - | + | </ | |
| - | ----------------- | + | * 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. | |
| - | ====== Add a Permanent User using the API ====== | + | * With the sample script we use two APIs |
| - | + | * The one API is used get a list of Permanent | |
| - | * Below is a simple as possible script that can be used as reference when adding | + | * The other API is used to either enable or disable |
| - | * We also show the optional fields that can be included in the API call. | + | |
| <file php permanent_user_disable_enable.php> | <file php permanent_user_disable_enable.php> | ||
| <?php | <?php | ||
| Line 28: | Line 27: | ||
| | | ||
| $username | $username | ||
| - | $action | + | $action |
| | | ||
| // Filter settings | // Filter settings | ||
| Line 35: | Line 34: | ||
| $value | $value | ||
| $limit | $limit | ||
| - | + | ||
| - | $find_url | + | $filter_array = [ |
| + | [ | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | ]; | ||
| + | |||
| + | $encoded_filter = urlencode(json_encode($filter_array)); | ||
| + | |||
| + | $find_url = " | ||
| | | ||
| Line 69: | Line 78: | ||
| ] | ] | ||
| ]); | ]); | ||
| + | | ||
| + | print($find_url); | ||
| // Get the response | // Get the response | ||
| Line 87: | Line 98: | ||
| $listOfIds[$id] = $id; | $listOfIds[$id] = $id; | ||
| } | } | ||
| - | echo "There $count items!"; | + | echo "There $count items\n"; |
| return $listOfIds; | return $listOfIds; | ||
| } else { | } else { | ||
| Line 94: | Line 105: | ||
| return false; | return false; | ||
| } | } | ||
| - | + | ||
| ?> | ?> | ||
| </ | </ | ||
| - | * Now that we have created | + | * We are not limited to only one user but we can adjust the filter for instance to disable all the users with a specific suffix e.g. @dev. |
| - | + | * For this we have to make the following adjustments: | |
| + | <code php> | ||
| + | $username | ||
| + | $action | ||
| + | |||
| + | // Filter settings | ||
| + | $filter | ||
| + | $operator | ||
| + | $value | ||
| + | $limit | ||
| + | </ | ||
| + | * By the same token, if we want to enable all disabled users we can adjust the filter as follows: | ||
| + | <code php> | ||
| + | $action | ||
| + | |||
| + | // Filter settings | ||
| + | $filter | ||
| + | $operator | ||
| + | $value | ||
| + | $limit | ||
| + | </ | ||