Deployment Guide

270 | ChangeToRole() Dell Networking W-ClearPass Guest 6.0 | Deployment Guide
This template function does not generate any output if the _assign parameter is set.
The methods that are available for use with this function are listed below. The $criteria array consists of one or more
criteria on which to perform a database search. The array is used for advanced cases where pre-defined helper
functions do not provide required flexibility.
ChangeToRole()
ChangeToRole($username, $role_name)
Changes the RADIUS role assigned to the user. If the user currently has active sessions, this function will trigger an
RFC 3576 Change-of-Authorization (CoA) Request to the network access server.
The $username parameter specifies the user account to modify; use the expression GetAttr('User-Name') to use the
value from the RADIUS User-Name attribute.
The $role_name parameter specifies the name of the RADIUS User Role to apply to the user.
Example:
Use the following as a conditional expression for an attribute. If the user's traffic in the past 24 hours exceeds 50
MB, the user is changed to the "Over-Quota" role.
return GetUserTraffic(86400) > 50e6 && ChangeToRole("Over-Quota");
GetCallingStationCurrentSession()
GetCallingStationCurrentSession($callingstationid, $mac_format = null)
Looks up the current (most recent) active session for the specified calling station ID.
Because different NAS equipment can send differently-formatted MAC addresses in the Calling-Station-Id attribute,
the $mac_format argument may be specified. This should be a sprintf-style format string that accepts 6 arguments
(the octets of the MAC address). The default if not specified is the IEEE 802 standard format,
%02X-%02X-%02X-%02X-%02X-%02X that is, uppercase hexadecimal with each octet separated with a hyphen.
See "GetCurrentSession() " on page 271 for details of the return value.
GetCallingStationSessions()
GetCallingStationSessions($callingstationid, $from_time, $to_time = null, $mac_format = nu
ll)
Calculate the number of sessions for accounting records matching a specific calling-station-id. The calling station id
address is looked up automatically from the RADIUS Access-Request (Calling-Station-ID attribute).
Because different NAS equipment can send differently-formatted MAC addresses in the Calling-Station-Id attribute,
the $mac_format argument may be specified. This should be a sprintf-style format string that accepts 6 arguments
(the octets of the MAC address). The default if not specified is the IEEE 802 standard format,
%02X-%02X-%02X-%02X-%02X-%02X that is, uppercase hexadecimal with each octet separated with a hyphen.
See "GetTraffic() " on page 274 for details on how to specify the time interval.
GetCallingStationTime()
GetCallingStationTime($callingstationid, $from_time, $to_time = null, $mac_format = null)
Calculate sum of session times in a specified time interval.
Because different NAS equipment can send differently-formatted MAC addresses in the Calling-Station-Id attribute,
the $mac_format argument may be specified. This should be a sprintf-style format string that accepts 6 arguments
(the octets of the MAC address). The default if not specified is the IEEE 802 standard format,
%02X-%02X-%02X-%02X-%02X-%02X that is, uppercase hexadecimal with each octet separated with a hyphen.
The calling station ID is looked up automatically from the RADIUS Access-Request (Calling-Station-ID attribute).