Closed VelaJafet closed 3 years ago
@boenrobot
When adding the user, leave the "server" option empty (or set to NULL). The default is "all", so that's what will be used. I'm not sure what would happen if you had a hotspot server called "all", or if that's even allowed (and I don't have a RouterOS install to try this on right now...), but in case it is allowed, you'll want to handle this edge case somehow.
Similarly with the default value for the "address-pool" in "/ip hotspot". If you don't want to include a value for it, leave it empty, and it will default to not having an "address-pool" (seen as "none" in Winbox). If the name of your IP pool is "all", you can just specify the "all" name. Again, I don't know if you can create an IP pool with the name "none", but this is an edge case you may want to address somehow.
How exactly to address both of these edge cases? One sure way is to go through the referenced menu's "find" command to get the ID of the item with the given name. Even if it's named with a keyword, you'll get an ID if it exists, or an empty string if not. Pass the ID if it exists, or error if not. Use NULL when your form's input is empty.
Thank you, you are right, to get the option as "NONE", "ALL", etc; I have to set in NULL
I'm development a little system to interacte with Hotspot menu, i want to save the Hotspot Servers to use them when I create Users.
This is what I see in Winbox
These are the options to assignanment when I create a User by Winbox (my manually server created and the "all" option)
I'm using Util and this is the code that I'm using to print the Hotspot Servers
This is what I receive with the code shown above
This is what other system returns me (include the "all" option)
How can I save the "all" option to use it? That's my question