The checks within the devices.php for canWrite referenced $cab, but that variable was not instantiated in all cases, so I moved that portion one level further out in the nested if loops.  Left a debug statement commented out, but in the code, for easier debug in the future.

Also added the Delete button if the same conditions existed that would allow a user to create a device.

Fixes #339