Hej,
w jakim momencie chcesz kasować sesje clips?
jak przy edycji komputera w LMS ( zmiana MAC, IP )
to na wersji LMSa z 07.2014 plugin node_edit_before
class node_edit_before_redback_coa { private $lms;
/** * Class constructor * * @param object $LMS LMS object */ function __construct($LMS) { $this->lms = $LMS; }
/** * Action after node addition * * @param array $vars Node data * * @return array Node data */ function node_before($vars) { global $DB;
$logfile = '/tmp/lms_rb.log';
// zmiana MAC
$q = $DB->GetAll('SELECT m.mac FROM macs m JOIN nodes n ON (m.nodeid = n.id) WHERE n.id = ?', array($vars['id'])); $mac = strtolower($q[0]['mac']); $rb = $DB->GetRow('SELECT name,ip FROM redback_context WHERE id = (SELECT ne.redback_context_id FROM networks ne WHERE ne.address < (SELECT n.ipaddr FROM nodes n JOIN macs m ON (n.id = m.nodeid) WHERE m.mac = ? GROUP BY m.mac) AND broadcast(ne.address,inet_aton(ne.mask)) > (SELECT n.ipaddr FROM nodes n JOIN macs m ON (n.id = m.nodeid) WHERE m.mac = ? GROUP BY m.mac))', array($mac, $mac));
$change_mac = true;
foreach($vars['macs'] as $chmac){ if($mac==strtolower($chmac)) $change_mac = false; else{ exec("echo "User-Name=".strtolower($chmac)."" | radclient -x ".$rb['ip'].":3799 disconnect RB_COA_PASSWORD
".$logfile);
} }
if($change_mac){ exec("echo "User-Name=".$mac."" | radclient -x ".$rb['ip'].":3799 disconnect RB_COA_PASSWORD >>".$logfile); }
// zmiana IP
$q = $DB->GetAll('SELECT ipaddr FROM nodes WHERE id = ?', array($vars['id']));
if($q[0]['ipaddr']!=ip2long($vars['ipaddr'])){ exec("echo "User-Name=".$mac."" | radclient -x ".$rb['ip'].":3799 disconnect RB_COA_PASSWORD >>".$logfile); }
// always return $vars return $vars; } }
// Initialize plugin $redback_plugin = new node_edit_before_redback_coa($LMS);
// Register plugin actions: $LMS->RegisterHook('node_edit_before', array($redback_plugin, 'node_before'));
W dniu 2015-04-27 10:03, Grzegorz Czarnota - Beskid Media Sp. z o.o. napisał(a):
Witam, czy ma ktoś rozbudowanego LMS'a o obsługę RedBacka? Chodzi głównie o kasowanie sesji clips.
--
Pozdrawiam, Grzegorz Czarnota Beskid Media Sp. z o.o.
lms mailing list lms@lists.lms.org.pl http://lists.lms.org.pl/mailman/listinfo/lms