RESIDENTS, GUEST, ROOMMATE, ENIGMA2, ONKYO_AVR, PHTV: complete support for set-user strin in FHEMWEB attribute allowedCommands (forum #35338.0)

git-svn-id: https://svn.fhem.de/fhem/trunk@8276 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2015-03-23 09:59:15 +00:00
parent 918253925e
commit 38a78f4144
6 changed files with 74 additions and 12 deletions

View File

@ -271,8 +271,15 @@ sub RESIDENTS_Set($@) {
# restrict set commands if there is "set-user" in it
my $adminMode = 1;
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
$adminMode = 0
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ ) {
$adminMode = 0;
return "Forbidden command: set " . $a[1]
if ( lc( $a[1] ) eq "addroommate"
|| lc( $a[1] ) eq "addguest"
|| lc( $a[1] ) eq "removeroommate"
|| lc( $a[1] ) eq "removeguest"
|| lc( $a[1] ) eq "create" );
}
# states
my $states = (
@ -1065,6 +1072,10 @@ sub RESIDENTS_UpdateReadings (@) {
<b>create</b> &nbsp;&nbsp;wakeuptimer&nbsp;&nbsp; add several pre-configurations provided by RESIDENTS Toolkit. See separate section for details.
</li>
</ul>
<ul>
<u>Note:</u> If you would like to retrict access to admin set-commands (-> addGuest, addRoommate, removeGuest, create) you may your FHEMWEB instance's attribute allowedCommands like 'set,set-user'.
The string 'set-user' will ensure only non-admin set-commands can be executed when accessing FHEM using this FHEMWEB instance.
</ul>
</div><br>
<br>
<div style="margin-left: 2em">
@ -1306,6 +1317,10 @@ sub RESIDENTS_UpdateReadings (@) {
<b>create</b> &nbsp;&nbsp;wakeuptimer&nbsp;&nbsp; f&uuml;gt diverse Vorkonfigurationen auf Basis von RESIDENTS Toolkit hinzu. Siehe separate Sektion.
</li>
</ul>
<ul>
<u>Hinweis:</u> Sofern der Zugriff auf administrative set-Kommandos (-> addGuest, addRoommate, removeGuest, create) eingeschr&auml;nkt werden soll, kann in einer FHEMWEB Instanz das Attribut allowedCommands &auml;hnlich wie 'set,set-user' erweitert werden.
Die Zeichenfolge 'set-user' stellt dabei sicher, dass beim Zugriff auf FHEM &uuml;ber diese FHEMWEB Instanz nur nicht-administrative set-Kommandos ausgef&uuml;hrt werden k&ouml;nnen.
</ul>
</div><br>
<br>
<div style="margin-left: 2em">

View File

@ -289,8 +289,11 @@ sub GUEST_Set($@) {
# restrict set commands if there is "set-user" in it
my $adminMode = 1;
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
$adminMode = 0
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ ) {
$adminMode = 0;
return "Forbidden command: set " . $a[1]
if ( lc( $a[1] ) eq "create" );
}
# states
my $states = (
@ -1040,6 +1043,10 @@ sub GUEST_StartInternalTimers($$) {
<b>create</b> &nbsp;&nbsp;wakeuptimer&nbsp;&nbsp; add several pre-configurations provided by RESIDENTS Toolkit. See separate section in <a href="#RESIDENTS">RESIDENTS module commandref</a> for details.
</li>
</ul>
<ul>
<u>Note:</u> If you would like to retrict access to admin set-commands (-> create) you may your FHEMWEB instance's attribute allowedCommands like 'set,set-user'.
The string 'set-user' will ensure only non-admin set-commands can be executed when accessing FHEM using this FHEMWEB instance.
</ul>
</div><br>
<br>
<div style="margin-left: 2em">
@ -1319,6 +1326,10 @@ sub GUEST_StartInternalTimers($$) {
<b>create</b> &nbsp;&nbsp;wakeuptimer&nbsp;&nbsp; f&uuml;gt diverse Vorkonfigurationen auf Basis von RESIDENTS Toolkit hinzu. Siehe separate Sektion in der <a href="#RESIDENTS">RESIDENTS Modul Kommandoreferenz</a>.
</li>
</ul>
<ul>
<u>Hinweis:</u> Sofern der Zugriff auf administrative set-Kommandos (-> create) eingeschr&auml;nkt werden soll, kann in einer FHEMWEB Instanz das Attribut allowedCommands &auml;hnlich wie 'set,set-user' erweitert werden.
Die Zeichenfolge 'set-user' stellt dabei sicher, dass beim Zugriff auf FHEM &uuml;ber diese FHEMWEB Instanz nur nicht-administrative set-Kommandos ausgef&uuml;hrt werden k&ouml;nnen.
</ul>
</div><br>
<br>
<div style="margin-left: 2em">

View File

@ -294,8 +294,11 @@ sub ROOMMATE_Set($@) {
# restrict set commands if there is "set-user" in it
my $adminMode = 1;
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
$adminMode = 0
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ ) {
$adminMode = 0;
return "Forbidden command: set " . $a[1]
if ( lc( $a[1] ) eq "create" );
}
# states
my $states = (
@ -1021,6 +1024,10 @@ sub ROOMMATE_StartInternalTimers($$) {
<b>create</b> &nbsp;&nbsp;wakeuptimer&nbsp;&nbsp; add several pre-configurations provided by RESIDENTS Toolkit. See separate section in <a href="#RESIDENTS">RESIDENTS module commandref</a> for details.
</li>
</ul>
<ul>
<u>Note:</u> If you would like to retrict access to admin set-commands (-> create) you may your FHEMWEB instance's attribute allowedCommands like 'set,set-user'.
The string 'set-user' will ensure only non-admin set-commands can be executed when accessing FHEM using this FHEMWEB instance.
</ul>
</div><br>
<br>
<div style="margin-left: 2em">
@ -1300,6 +1307,10 @@ sub ROOMMATE_StartInternalTimers($$) {
<b>create</b> &nbsp;&nbsp;wakeuptimer&nbsp;&nbsp; f&uuml;gt diverse Vorkonfigurationen auf Basis von RESIDENTS Toolkit hinzu. Siehe separate Sektion in der <a href="#RESIDENTS">RESIDENTS Modul Kommandoreferenz</a>.
</li>
</ul>
<ul>
<u>Hinweis:</u> Sofern der Zugriff auf administrative set-Kommandos (-> create) eingeschr&auml;nkt werden soll, kann in einer FHEMWEB Instanz das Attribut allowedCommands &auml;hnlich wie 'set,set-user' erweitert werden.
Die Zeichenfolge 'set-user' stellt dabei sicher, dass beim Zugriff auf FHEM &uuml;ber diese FHEMWEB Instanz nur nicht-administrative set-Kommandos ausgef&uuml;hrt werden k&ouml;nnen.
</ul>
</div><br />
<br />
<div style="margin-left: 2em">

View File

@ -214,8 +214,14 @@ sub ENIGMA2_Set($@) {
# restrict set commands if there is "set-user" in it
my $adminMode = 1;
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
$adminMode = 0
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ ) {
$adminMode = 0;
return "Forbidden command: set " . $a[1]
if ( lc( $a[1] ) eq "statusrequest"
|| lc( $a[1] ) eq "reboot"
|| lc( $a[1] ) eq "restartgui"
|| lc( $a[1] ) eq "shutdown" );
}
# load channel list
if (
@ -3046,6 +3052,10 @@ sub ENIGMA2_GetRemotecontrolCommand($) {
<b>msg</b> yesno,info... &nbsp;&nbsp;-&nbsp;&nbsp; allows more complex messages as showText, see commands as listed below
</li>
</ul>
<ul>
<u>Note:</u> If you would like to retrict access to admin set-commands (-> statusRequest, reboot, restartGui, shutdown) you may your FHEMWEB instance's attribute allowedCommands like 'set,set-user'.
The string 'set-user' will ensure only non-admin set-commands can be executed when accessing FHEM using this FHEMWEB instance.
</ul>
</div><br>
<br>
<div style="margin-left: 2em">

View File

@ -611,8 +611,12 @@ sub ONKYO_AVR_Set($@) {
# restrict set commands if there is "set-user" in it
my $adminMode = 1;
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
$adminMode = 0
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ ) {
$adminMode = 0;
return "Forbidden command: set " . $a[1]
if ( lc( $a[1] ) eq "statusrequest"
|| lc( $a[1] ) eq "remotecontrol" );
}
# Input alias handling
if ( defined( $attr{$name}{inputs} ) && $attr{$name}{inputs} ne "" ) {
@ -1728,6 +1732,10 @@ sub ONKYO_AVR_RClayout() {
<b>remoteControl</b> &nbsp;&nbsp;-&nbsp;&nbsp; sends remote control commands; see remoteControl help
</li>
</ul>
<ul>
<u>Note:</u> If you would like to retrict access to admin set-commands (-> statusRequest, remoteControl) you may your FHEMWEB instance's attribute allowedCommands like 'set,set-user'.
The string 'set-user' will ensure only non-admin set-commands can be executed when accessing FHEM using this FHEMWEB instance.
</ul>
</div><br>
<br>
<a name="ONKYO_AVRget" id="ONKYO_AVRget"></a> <b>Get</b>

View File

@ -285,8 +285,11 @@ sub PHTV_Set($@) {
# restrict set commands if there is "set-user" in it
my $adminMode = 1;
my $FWallowedCommands = AttrVal( $FW_wname, "allowedCommands", 0 );
$adminMode = 0
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ );
if ( $FWallowedCommands && $FWallowedCommands =~ m/\bset-user\b/ ) {
$adminMode = 0;
return "Forbidden command: set " . $a[1]
if ( lc( $a[1] ) eq "statusrequest" );
}
# Input alias handling
if ( defined( $attr{$name}{inputs} ) && $attr{$name}{inputs} ne "" ) {
@ -3351,6 +3354,10 @@ sub PHTV_min {
<li><b>record</b> &nbsp;&nbsp;-&nbsp;&nbsp; starts recording of current channel</li>
</ul>
</ul>
<ul>
<u>Note:</u> If you would like to retrict access to admin set-commands (-> statusRequest) you may your FHEMWEB instance's attribute allowedCommands like 'set,set-user'.
The string 'set-user' will ensure only non-admin set-commands can be executed when accessing FHEM using this FHEMWEB instance.
</ul>
<br>
<br>