Hy all I would like to use the name of the group a user is member of to update the check item list. I though using unlang to do so, and an update directive but icannot find the variable name (if any) to use for the name of the group. I have "%{Group}" "%{Group-Name}" "%{SQL-GROUP}" but no success: expansions always gives me an empty string. The groups are stored in MySQL database. the update directive is at the end of the autorize section.... Does anyone knows how to refer to the group?
The name of the attribute you want is used in mysql dialup.conf (group check query) and is printed out *every time* you run radiusd -X (both when server starts and *each* time you process the request). For less obvious attributes used by the server look up freeradius.internal dictionary - dictionaries are the obvious place to look if you are not sure what the name of some attribute is exactly (when you run into a word you don't know you also look in the - dictionary). You need to use lists with attributes in unlang (in this case attribute is from control list) since default is request. Ivan Kalik Kalik Informatika ISP Dana 18/10/2008, "Alexandre Chapellon" <alexandre.chapellon@mana.pf> piše:
Hy all
I would like to use the name of the group a user is member of to update the check item list. I though using unlang to do so, and an update directive but icannot find the variable name (if any) to use for the name of the group. I have "%{Group}" "%{Group-Name}" "%{SQL-GROUP}" but no success: expansions always gives me an empty string. The groups are stored in MySQL database.
the update directive is at the end of the autorize section....
Does anyone knows how to refer to the group? - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
tnt@kalik.net a écrit :
The name of the attribute you want is used in mysql dialup.conf (group check query) and is printed out *every time* you run radiusd -X (both when server starts and *each* time you process the request). For less obvious attributes used by the server look up freeradius.internal dictionary - dictionaries are the obvious place to look if you are not sure what the name of some attribute is exactly (when you run into a word you don't know you also look in the - dictionary).
Thanks, I saw this, but unfortunaltely whereas in dialup.conf the variable is '%{Sql-Group}', It seems i cannot re-use it outside of an sql module. I have even tried to add an update control directive to add a Tmp-String-0 (correctly expanded in the sql module) at the end of the sql module and so re-use it at the end of the aythorize section (outside sql module), but it doesn't work as it's expanded to an empty string...
You need to use lists with attributes in unlang (in this case attribute is from control list) since default is request.
same result with "%{control:Tmp-String-0}".
Ivan Kalik Kalik Informatika ISP
Dana 18/10/2008, "Alexandre Chapellon" <alexandre.chapellon@mana.pf> piše:
Hy all
I would like to use the name of the group a user is member of to update the check item list. I though using unlang to do so, and an update directive but icannot find the variable name (if any) to use for the name of the group. I have "%{Group}" "%{Group-Name}" "%{SQL-GROUP}" but no success: expansions always gives me an empty string. The groups are stored in MySQL database.
the update directive is at the end of the autorize section....
Does anyone knows how to refer to the group? - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Thanks, I saw this, but unfortunaltely whereas in dialup.conf the variable is '%{Sql-Group}', It seems i cannot re-use it outside of an sql module.
That is probably a bug then. Sql-Group should be available outside sql module. I've used it in huntgroups in 1.1.7.
I have even tried to add an update control directive to add a Tmp-String-0 (correctly expanded in the sql module) at the end of the sql module and so re-use it at the end of the aythorize section (outside sql module), but it doesn't work as it's expanded to an empty string...
That's OK. unlang doesn't work inside module configuration, only server configuration.
You need to use lists with attributes in unlang (in this case attribute is from control list) since default is request.
same result with "%{control:Tmp-String-0}".
Let's try a workaround. Get group name by executing query again in authorize section: update control { Tmp-String-0 := "%{sql:SELECT GroupName FROM radusergroup WHERE UserName='%{User-Name}' ORDER BY priority}" } "%{control:Tmp-String-0}" will hold group name then. Ivan Kalik Kalik Informatika ISP
tnt@kalik.net a écrit :
Thanks, I saw this, but unfortunaltely whereas in dialup.conf the variable is '%{Sql-Group}', It seems i cannot re-use it outside of an sql module.
That is probably a bug then. Sql-Group should be available outside sql module. I've used it in huntgroups in 1.1.7.
I have even tried to add an update control directive to add a Tmp-String-0 (correctly expanded in the sql module) at the end of the sql module and so re-use it at the end of the aythorize section (outside sql module), but it doesn't work as it's expanded to an empty string...
That's OK. unlang doesn't work inside module configuration, only server configuration.
You need to use lists with attributes in unlang (in this case attribute is from control list) since default is request.
same result with "%{control:Tmp-String-0}".
Let's try a workaround. Get group name by executing query again in authorize section:
update control { Tmp-String-0 := "%{sql:SELECT GroupName FROM radusergroup WHERE UserName='%{User-Name}' ORDER BY priority}" }
"%{control:Tmp-String-0}" will hold group name then.
This already works .... the goal was to avoid mulplication of sql queries. But if there is no other solutions..... thx anyway
Ivan Kalik Kalik Informatika ISP
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
same result with .
Let's try a workaround. Get group name by executing query again in authorize section:
update control { Tmp-String-0 := "%{sql:SELECT GroupName FROM radusergroup WHERE UserName='%{User-Name}' ORDER BY priority}" }
"%{control:Tmp-String-0}" will hold group name then.
This already works .... the goal was to avoid mulplication of sql queries. But if there is no other solutions.....
I am not sure what's going on. "%{control:Sql-Group}" expands to an empty string in unlang. But: DEFAULT Sql-Group == "dialup" matches in users file as expected. For that same request!? Ivan Kalik Kalik Informatika ISP
participants (2)
-
Alexandre Chapellon -
tnt@kalik.net