Framed-Pool getTableCustomerAttr
This commit is contained in:
parent
7e4c638b07
commit
6884701de1
@ -28,6 +28,11 @@ class Radius
|
|||||||
return ORM::for_table('radcheck', 'radius');
|
return ORM::for_table('radcheck', 'radius');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getTableCustomerAttr()
|
||||||
|
{
|
||||||
|
return ORM::for_table('radreply', 'radius');
|
||||||
|
}
|
||||||
|
|
||||||
public static function getTablePackage()
|
public static function getTablePackage()
|
||||||
{
|
{
|
||||||
return ORM::for_table('radgroupreply', 'radius');
|
return ORM::for_table('radgroupreply', 'radius');
|
||||||
@ -89,9 +94,9 @@ class Radius
|
|||||||
Radius::upsertPackage($plan_id, 'Ascend-Data-Rate', $rates[1], ':=');
|
Radius::upsertPackage($plan_id, 'Ascend-Data-Rate', $rates[1], ':=');
|
||||||
Radius::upsertPackage($plan_id, 'Ascend-Xmit-Rate', $rates[0], ':=');
|
Radius::upsertPackage($plan_id, 'Ascend-Xmit-Rate', $rates[0], ':=');
|
||||||
Radius::upsertPackage($plan_id, 'Mikrotik-Rate-Limit', $rate, ':=');
|
Radius::upsertPackage($plan_id, 'Mikrotik-Rate-Limit', $rate, ':=');
|
||||||
if ($pool != null) {
|
// if ($pool != null) {
|
||||||
Radius::upsertPackage($plan_id, 'Framed-Pool', $pool, ':=');
|
// Radius::upsertPackage($plan_id, 'Framed-Pool', $pool, ':=');
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function planDelete($plan_id)
|
public static function planDelete($plan_id)
|
||||||
@ -214,6 +219,10 @@ class Radius
|
|||||||
Radius::delAtribute(Radius::getTableCustomer(), 'access-period', 'username', $customer['username']);
|
Radius::delAtribute(Radius::getTableCustomer(), 'access-period', 'username', $customer['username']);
|
||||||
Radius::delAtribute(Radius::getTableCustomer(), 'expiration', 'username', $customer['username']);
|
Radius::delAtribute(Radius::getTableCustomer(), 'expiration', 'username', $customer['username']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($plan['type'] == 'PPPOE') {
|
||||||
|
Radius::upsertCustomerAttr($customer['username'], 'Framed-Pool', $plan['pool'], ':=');
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -271,6 +280,21 @@ class Radius
|
|||||||
$r->value = $value;
|
$r->value = $value;
|
||||||
return $r->save();
|
return $r->save();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* To insert or update existing customer Attribute
|
||||||
|
*/
|
||||||
|
private static function upsertCustomerAttr($username, $attr, $value, $op = ':=')
|
||||||
|
{
|
||||||
|
$r = Radius::getTableCustomerAttr()->where_equal('username', $username)->whereEqual('attribute', $attr)->find_one();
|
||||||
|
if (!$r) {
|
||||||
|
$r = Radius::getTableCustomerAttr()->create();
|
||||||
|
$r->username = $username;
|
||||||
|
}
|
||||||
|
$r->attribute = $attr;
|
||||||
|
$r->op = $op;
|
||||||
|
$r->value = $value;
|
||||||
|
return $r->save();
|
||||||
|
}
|
||||||
|
|
||||||
public static function disconnectCustomer($username)
|
public static function disconnectCustomer($username)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user