Skip to content

Commit

Permalink
ws281x - Update logic to identify is user is admin (#1623)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Grey authored Aug 3, 2023
1 parent c0dc08b commit d1879c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/webconfig/js/content_leds.js
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ var updateOutputSelectList = function (ledType, discoveryInfo) {
case "devRPiPWM":
key = ledType;

if (discoveryInfo.devices.length == 0) {
if (!discoveryInfo.isUserAdmin) {
enumVals.push("NONE");
enumTitleVals.push($.i18n('edt_dev_spec_devices_discovered_none'));
$('#btn_submit_controller').prop('disabled', true);
Expand Down
10 changes: 4 additions & 6 deletions libsrc/leddevice/dev_rpi_pwm/LedDeviceWS281x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,10 @@ QJsonObject LedDeviceWS281x::discover(const QJsonObject& /*params*/)

QJsonArray deviceList;

if (SysInfo::isUserAdmin())
{
//Indicate the general availability of the device, if hyperion is run under root
deviceList << QJsonObject ({{"found",true}});
devicesDiscovered.insert("devices", deviceList);
}
//Indicate the general availability of the device, if hyperion is run under root
devicesDiscovered.insert("isUserAdmin", SysInfo::isUserAdmin());

devicesDiscovered.insert("devices", deviceList);

DebugIf(verbose,_log, "devicesDiscovered: [%s]", QString(QJsonDocument(devicesDiscovered).toJson(QJsonDocument::Compact)).toUtf8().constData());

Expand Down

0 comments on commit d1879c2

Please sign in to comment.