72 lines
2.3 KiB
Plaintext
72 lines
2.3 KiB
Plaintext
|
|
adding a new device
|
|
example post /device/new
|
|
macaddress,group
|
|
removing an existing device
|
|
|
|
listing vlans
|
|
GET /vlan/
|
|
SELECT * FROM `radgroupreply`
|
|
this will return 3 duplicate "groupnames" with different attribute and vlaue
|
|
only need to return group name and value for Tunnel-Private-Group-Id
|
|
|
|
adding new vlan
|
|
need to add 3 items with different attribute and value,
|
|
for example to add staff vlan with vlan ID 55
|
|
api call should be like POST vlan/add and json data vlanid:55, alias staff
|
|
|
|
'INSERT INTO `radgroupreply` (`groupname`, `attribute`, `op`, `value`)
|
|
VALUES ('staff', 'Tunnel-Type', '=', 'VLAN');
|
|
|
|
INSERT INTO `radgroupreply` (`groupname`, `attribute`, `op`, `value`)
|
|
VALUES ('staff', 'Tunnel-Medium-Type', '=', 'IEEE-802');
|
|
|
|
INSERT INTO `radgroupreply` (`groupname`, `attribute`, `op`, `value`)
|
|
VALUES ('staff', 'Tunnel-Private-Group-Id', '=', '55');
|
|
'
|
|
deleting existing vlan
|
|
you get api call to delete vlan
|
|
DELETE vlan/55
|
|
and the sqlcommands should you looking for Tunnel-Private-Group-Id=55 and then deleting all the maching group names
|
|
|
|
edit existing vlan (alias)
|
|
post request, and allow to edit alias
|
|
|
|
disallow to add duplicate vlans or alias
|
|
|
|
listing existing devices
|
|
get /device/
|
|
SELECT * FROM `radusergroup`
|
|
and then
|
|
SELECT * FROM `customers`
|
|
return mac address, groupname and status
|
|
|
|
adding new device
|
|
this input feils are
|
|
'
|
|
POST /device/add with mac address and group and it involves few Commands
|
|
`
|
|
SELECT * FROM `radgroupreply`
|
|
# and see if the group in the device add command exists
|
|
# respond 4xx (whatever needed with reason group not found)
|
|
# else continue
|
|
|
|
INSERT INTO `radcheck` (`username`, `attribute`, `op`, `value`)
|
|
VALUES ('14-99-3E-74-CB-7F', 'Cleartext-Password', ':=', '14-99-3E-74-CB-7F');
|
|
|
|
INSERT INTO `radusergroup` (`username`, `groupname`, `priority`)
|
|
VALUES ('14-99-3E-74-CB-7F', 'staff', '1');
|
|
|
|
INSERT INTO `customers` (`username`, `mac_address`, `status`, `created_at`)
|
|
VALUES ('14-99-3E-74-CB-7F', '14-99-3E-74-CB-7F', 'paid', now());
|
|
`
|
|
|
|
deleting existing deivce
|
|
edit existing device (input macaddress, edit groupname, edit status. do allow to edit just 1 feild)
|
|
use sesnible commands based on add devices
|
|
|
|
i would also like a device alias, added to customers table like
|
|
"Customer name, device name, phone number"
|
|
these are to be ignored by radius server, but helpful for human review
|
|
and add input fields during adding device and also listing devices
|