Skip to content
Permalink
Browse files

Simple Devices links config

* Simple Devices: access control added for simple devices' links
  • Loading branch information...
sergejey committed Apr 29, 2019
1 parent 8662efe commit c7e6fcc6101dd54a80d53b14a61d6a8d938d6cdb
@@ -589,7 +589,7 @@ function delete_commands($id) {
if ($tmp['ID']) {
return;
}
SQLExec("DELETE FROM security_rules WHERE OBJECT_TYPE='menu' AND OBJECT_ID=".(int)$rec['ID']);
SQLExec("DELETE FROM commands WHERE ID='".$rec['ID']."'");
}
/**
@@ -2,6 +2,7 @@
if ($this->edit_mode=='delete_link') {
global $link_id;
SQLExec("DELETE FROM security_rules WHERE OBJECT_TYPE='sdevice' AND OBJECT_ID=".(int)$link_id);
SQLExec("DELETE FROM devices_linked WHERE ID=".(int)$link_id);
$this->redirect("?id=".$rec['ID']."&tab=".$this->tab."&view_mode=".$this->view_mode);
}
@@ -149,6 +149,7 @@
$links = SQLSelect("SELECT devices_linked.*, devices.LINKED_OBJECT FROM devices_linked LEFT JOIN devices ON devices_linked.DEVICE2_ID=devices.ID WHERE DEVICE1_ID=" . (int)$device1['ID']);
$total = count($links);
for ($i = 0; $i < $total; $i++) {
if (!checkAccess('sdevice',$links[$i]['ID'])) continue;
$link_type = $links[$i]['LINK_TYPE'];
$object = $links[$i]['LINKED_OBJECT'];
$settings = unserialize($links[$i]['LINK_SETTINGS']);
@@ -105,6 +105,15 @@
</div>
[#end LINK_DETAILS_PARAMS#]

[#if LINK_ID!=""#]
<div class="form-group">
<label class="control-label"><#LANG_ACCESS_CONTROL#>:<#LANG_HCB#>access_control<#LANG_HCE#></label>
<div class="col-lg-5">
<a href="?(panel:{action=security_rules})&object_type=sdevice&object_id=<#LINK_ID#>&print=1" onClick="return openModalTWindow('security', '<#LANG_ACCESS_CONTROL#>', this.href, 800, 600);" target=_blank><#LANG_SET#></a>
</div>
</div>
[#endif#]

<div class="form-group">
<label class="col-md-4 control-label">
<#LANG_DEVICES_LINKS_COMMENT#>:
@@ -142,19 +142,25 @@
// ----------------------------------------------------------------------
function openTWindow(winId, winTitle, pageURL, wdth, hdth) {
/*
var jWindowObj = $.jWindow({ id: winId, title: winTitle, posx: 200, posy: 100, width: wdth, height: hdth, type: 'iframe', url: pageURL, modal: false });
jWindowObj.show();
jWindowObj.update();
$('#usersWindow').center();
*/
parent.$.fancybox.open({ src: pageURL, type: 'iframe',iframe:{preload:false}});
return false;
}
function openModalTWindow(winId, winTitle, pageURL, wdth, hdth) {
/*
var jWindowObj = $.jWindow({ id: winId, title: winTitle, posx: 200, posy: 100, width: wdth, height: hdth, type: 'iframe', url: pageURL, minimiseButton:false, maximiseButton:false, draggable:false, resizeable:false, modal: true });
jWindowObj.show();
jWindowObj.update();
$('#usersWindow').center();
*/
parent.$.fancybox.open({ src: pageURL, type: 'iframe',iframe:{preload:false}});
return false;
}
@@ -1,4 +1,5 @@

&nbsp;
<div class="container">
<!-- Table 'security_rules' edit -->
<form action="?" method="post" enctype="multipart/form-data" name="frmEdit" class="form-horizontal">
[#if OK#]
@@ -170,3 +171,4 @@
</div>
</fieldset>
</form>
</div>

0 comments on commit c7e6fcc

Please sign in to comment.
You can’t perform that action at this time.