mirror of
https://github.com/unraid/webgui.git
synced 2026-03-13 14:30:29 -05:00
Merge pull request #505 from bergware/master
Add share access to user edit
This commit is contained in:
@@ -4,8 +4,8 @@ Tag="user-circle-o"
|
||||
Cond="$var['fsState']!='Stopped' && $var['shareDisk']!='no'"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2019, Lime Technology
|
||||
* Copyright 2012-2019, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -34,7 +34,7 @@ $(function() {
|
||||
</script>
|
||||
|
||||
<table class="share_status share">
|
||||
<thead><tr><td style="width:15%">Name</td><td style="width:33%">Comment</td><td>SMB</td><td>NFS</td><td>AFP</td><td>Size</td><td>Free</td><td>View</td></tr></thead>
|
||||
<thead><tr><td style="width:15%">Name</td><td style="width:33%">Comment</td><td>SMB</td><td>NFS</td><td>AFP</td><td style="width:8%">Type</td><td style="width:8%">Size</td><td style="width:8%">Free</td><td style="width:4%">View</td></tr></thead>
|
||||
<tbody id="disk_list"></tbody>
|
||||
</table>
|
||||
<p><input id="compute-disks" type="button" value="Compute All" onclick="$(this).prop('disabled',true);displayDisks('yes')"></p>
|
||||
|
||||
@@ -4,8 +4,8 @@ Icon="icon-key"
|
||||
Tag="expeditedssl"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2019, Lime Technology
|
||||
* Copyright 2012-2019, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -47,7 +47,6 @@ $disabled_updatedns = $keyfile!==false && $isLEcert ? '' : 'disabled';
|
||||
$internalip = $eth0['IPADDR:0'];
|
||||
$tasks = find_tasks();
|
||||
?>
|
||||
<style>input.trim{width:65px}</style>
|
||||
<script>
|
||||
function provisionSSL(button) {
|
||||
var oldlabel = $.trim($(button).text());
|
||||
@@ -136,7 +135,7 @@ $(function(){
|
||||
<form markdown="1" name="SSLSettings" method="POST" action="/update.htm" target="progressFrame">
|
||||
<input type="hidden" name="changePorts" value="apply">
|
||||
Start page:
|
||||
: <select name="START_PAGE" size="1" class="narrow">
|
||||
: <select name="START_PAGE" size="1">
|
||||
<?foreach ($tasks as $task) echo mk_option($var['START_PAGE']??'Main', $task, $task);?>
|
||||
</select>
|
||||
|
||||
@@ -155,7 +154,7 @@ Restrict access:
|
||||
-->
|
||||
|
||||
Use TELNET:
|
||||
: <select name="USE_TELNET" size="1" class="narrow" onchange="updateTELNET(this.form)">
|
||||
: <select name="USE_TELNET" size="1" onchange="updateTELNET(this.form)">
|
||||
<?=mk_option($var['USE_TELNET'], "no", "No")?>
|
||||
<?=mk_option($var['USE_TELNET'], "yes", "Yes")?>
|
||||
</select>
|
||||
@@ -164,12 +163,12 @@ Use TELNET:
|
||||
> and it is highly recommended to use SSH access instead and disable TELNET access.
|
||||
|
||||
TELNET port:
|
||||
: <input type="number" name="PORTTELNET" class="trim" min="1" max="65535" value="<?=htmlspecialchars($var['PORTTELNET']??23)?>">
|
||||
: <input type="number" name="PORTTELNET" class="narrow" min="1" max="65535" value="<?=htmlspecialchars($var['PORTTELNET']??23)?>">
|
||||
|
||||
> Enter the TELNET port, default port is 23.
|
||||
|
||||
Use SSH:
|
||||
: <select name="USE_SSH" size="1" class="narrow" onchange="updateSSH(this.form)">
|
||||
: <select name="USE_SSH" size="1" onchange="updateSSH(this.form)">
|
||||
<?=mk_option($var['USE_SSH'], "no", "No")?>
|
||||
<?=mk_option($var['USE_SSH'], "yes", "Yes")?>
|
||||
</select>
|
||||
@@ -178,12 +177,23 @@ Use SSH:
|
||||
> if not yet existing, and stored on the flash device in the folder */config/ssh*.
|
||||
|
||||
SSH port:
|
||||
: <input type="number" name="PORTSSH" class="trim" min="1" max="65535" value="<?=htmlspecialchars($var['PORTSSH']??22)?>">
|
||||
: <input type="number" name="PORTSSH" class="narrow" min="1" max="65535" value="<?=htmlspecialchars($var['PORTSSH']??22)?>">
|
||||
|
||||
> Enter the SSH port, default port is 22.
|
||||
|
||||
<?if (file_exists('/var/log/plugins/dynamix.wireguard.plg')):?>
|
||||
Use UPnP:
|
||||
: <select name="USE_UPNP" size="1">
|
||||
<?=mk_option($var['USE_UPNP'], "yes", "Yes")?>
|
||||
<?=mk_option($var['USE_UPNP'], "no", "No")?>
|
||||
</select>
|
||||
|
||||
> Enable (default) or disable the UPnP function on the server. This function allows automatic forwarding of ports on the router, only applicable when UPnP is enabled on the router itself.
|
||||
|
||||
<?endif;?>
|
||||
|
||||
Use SSL/TLS:
|
||||
: <select name="USE_SSL" size="1" class="narrow" onchange="updateSSL(this.form)">
|
||||
: <select name="USE_SSL" size="1" onchange="updateSSL(this.form)">
|
||||
<?=mk_option($var['USE_SSL'], "auto", "Auto")?>
|
||||
<?=mk_option($var['USE_SSL'], "no", "No")?>
|
||||
<?=mk_option($var['USE_SSL'], "yes", "Yes")?>
|
||||
@@ -232,17 +242,17 @@ Use SSL/TLS:
|
||||
> `config/ssl/certs/<server-name>_unraid_bundle.pem` => No
|
||||
|
||||
HTTP port:
|
||||
: <input type="number" name="PORT" class="trim" min="1" max="65535" value="<?=htmlspecialchars($var['PORT']??80)?>">
|
||||
: <input type="number" name="PORT" class="narrow" min="1" max="65535" value="<?=htmlspecialchars($var['PORT']??80)?>">
|
||||
|
||||
> Enter the HTTP port, default port is 80.
|
||||
|
||||
HTTPS port:
|
||||
: <input type="number" name="PORTSSL" class="trim" min="1" max="65535" value="<?=htmlspecialchars($var['PORTSSL']??443)?>">
|
||||
: <input type="number" name="PORTSSL" class="narrow" min="1" max="65535" value="<?=htmlspecialchars($var['PORTSSL']??443)?>">
|
||||
|
||||
> Enter the HTTPS port, default port is 443.
|
||||
|
||||
Local TLD:
|
||||
: <input type="text" name="LOCAL_TLD" value="<?=htmlspecialchars($var['LOCAL_TLD'])?>" class="narrow">
|
||||
: <input type="text" name="LOCAL_TLD" class="narrow" value="<?=htmlspecialchars($var['LOCAL_TLD'])?>">
|
||||
|
||||
> Enter your local Top Level Domain. May be blank.
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ Tag="user-circle"
|
||||
Cond="$var['fsState']!='Stopped' && $var['shareUser']=='e'"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2019, Lime Technology
|
||||
* Copyright 2012-2019, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -34,7 +34,7 @@ $(function() {
|
||||
</script>
|
||||
|
||||
<table class="share_status share">
|
||||
<thead><tr><td style="width:15%">Name</td><td style="width:33%">Comment</td><td>SMB</td><td>NFS</td><td>AFP</td><td>Size</td><td>Free</td><td>View</td></tr></thead>
|
||||
<thead><tr><td style="width:15%">Name</td><td style="width:33%">Comment</td><td>SMB</td><td>NFS</td><td>AFP</td><td style="width:8%">Cache</td><td style="width:8%">Size</td><td style="width:8%">Free</td><td style="width:4%">View</td></tr></thead>
|
||||
<tbody id="shareslist"></tbody>
|
||||
</table>
|
||||
<p><form name="share_form" method="POST" action="<?=htmlspecialchars($path)?>/Share?name=">
|
||||
|
||||
@@ -181,12 +181,12 @@ foreach ($users as $user) {
|
||||
}
|
||||
foreach ($shares as $share => $data) {
|
||||
echo "security[\"$share\"]=\"{$sec[$share]['security']}\";\n";
|
||||
echo "readList[\"$share\"]=\"{$sec[$share]['readList']},\";\n";
|
||||
echo "writeList[\"$share\"]=\"{$sec[$share]['writeList']},\";\n";
|
||||
echo "readList[\"$share\"]=\",{$sec[$share]['readList']},\";\n";
|
||||
echo "writeList[\"$share\"]=\",{$sec[$share]['writeList']},\";\n";
|
||||
}
|
||||
?>
|
||||
function updateAccess(form,data,n,i) {
|
||||
var name = "<?=$name?>,";
|
||||
var name = ",<?=$name?>,";
|
||||
if (data) {
|
||||
if (n<i) {
|
||||
$.post('/update.htm',data[n], function(){setTimeout(function(){updateAccess(form,data,++n,i);},1000);});
|
||||
@@ -210,11 +210,11 @@ function updateAccess(form,data,n,i) {
|
||||
access = '<?=$rw?>';
|
||||
break;
|
||||
case 'secure':
|
||||
if (user+',' == name) access = $(this).val();
|
||||
if (','+user+',' == name) access = $(this).val();
|
||||
else access = writeList[share].indexOf(name)!==-1 ? '<?=$rw?>' : '<?=$ro?>';
|
||||
break;
|
||||
case 'private':
|
||||
if (user+',' == name) access = $(this).val();
|
||||
if (','+user+',' == name) access = $(this).val();
|
||||
else access = writeList[share].indexOf(name)!==-1 ? '<?=$rw?>' : (readList[share].indexOf(name)!==-1 ? '<?=$ro?>' : '<?=$no?>');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2019, Lime Technology
|
||||
* Copyright 2012-2019, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -91,7 +91,9 @@ foreach ($disks as $name => $disk) {
|
||||
echo "<td>".disk_share_settings($var['shareNFSEnabled'], $sec_nfs[$name])."</td>";
|
||||
echo "<td>".disk_share_settings($var['shareAFPEnabled'], $sec_afp[$name])."</td>";
|
||||
$cmd="/webGui/scripts/disk_size"."&arg1=".urlencode($name)."&arg2=ssz2";
|
||||
$type = $disk['rotational'] ? 'HDD' : 'SSD';
|
||||
if (array_key_exists($name, $ssz2)) {
|
||||
echo "<td>$type</td>";
|
||||
echo "<td>".my_scale(($disk['fsSize'])*1024, $unit)." $unit</td>";
|
||||
echo "<td>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='Browse /mnt/$name'></a></td>";
|
||||
@@ -106,12 +108,14 @@ foreach ($disks as $name => $disk) {
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td class='disk-$row-1'>".my_scale($sharesize*1024, $unit)." $unit</td>";
|
||||
echo "<td class='disk-$row-2'>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' title='Recompute...' onclick='$.cookie(\"ssz\",\"ssz\",{path:\"/\"});$(\".disk-$row-1\").html(\"Please wait...\");$(\".disk-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
} else {
|
||||
echo "<td>$type</td>";
|
||||
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' onclick=\"$.cookie('ssz','ssz',{path:'/'});$(this).text('Please wait...')\">Compute...</a></td>";
|
||||
echo "<td>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='Browse /mnt/$name'></a></td>";
|
||||
@@ -119,6 +123,6 @@ foreach ($disks as $name => $disk) {
|
||||
}
|
||||
}
|
||||
if ($row==0) {
|
||||
echo "<tr><td colspan='8' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>There are no exportable disk shares</td></tr>";
|
||||
echo "<tr><td colspan='9' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>There are no exportable disk shares</td></tr>";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2019, Lime Technology
|
||||
* Copyright 2012-2019, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -17,18 +17,19 @@ switch ($_POST['cmd']) {
|
||||
case 'save':
|
||||
if (is_file("$docroot/$file") && strpos(realpath("$docroot/$file"), $docroot.'/') !== 0) exit;
|
||||
$source = $_POST['source'];
|
||||
if (pathinfo($source, PATHINFO_EXTENSION) == 'txt') {
|
||||
exec("zip -qlj ".escapeshellarg("$docroot/$file")." ".escapeshellarg($source));
|
||||
$opts = $_POST['opts'] ?? 'qlj';
|
||||
if (in_array(pathinfo($source, PATHINFO_EXTENSION),['txt','conf','png'])) {
|
||||
exec("zip -$opts ".escapeshellarg("$docroot/$file")." ".escapeshellarg($source));
|
||||
} else {
|
||||
$tmp = "/var/tmp/".basename($source).".txt";
|
||||
copy($source, $tmp);
|
||||
exec("zip -qlj ".escapeshellarg("$docroot/$file")." ".escapeshellarg($tmp));
|
||||
exec("zip -$opts ".escapeshellarg("$docroot/$file")." ".escapeshellarg($tmp));
|
||||
@unlink($tmp);
|
||||
}
|
||||
echo "/$file";
|
||||
break;
|
||||
case 'delete':
|
||||
if (strpos(realpath("$docroot/$file"), $docroot.'/') === 0) @unlink("$docroot/$file");
|
||||
if (strpos(realpath("$docroot/$file"), $docroot.'/')===0) @unlink("$docroot/$file");
|
||||
break;
|
||||
case 'diag':
|
||||
if (is_file("$docroot/$file") && strpos(realpath("$docroot/$file"), $docroot.'/') !== 0) exit;
|
||||
@@ -43,5 +44,5 @@ case 'unlink':
|
||||
case 'backup':
|
||||
echo exec("$docroot/webGui/scripts/flash_backup");
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2019, Lime Technology
|
||||
* Copyright 2012-2019, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -92,7 +92,9 @@ foreach ($shares as $name => $share) {
|
||||
echo "<td>".user_share_settings($var['shareNFSEnabled'], $sec_nfs[$name])."</td>";
|
||||
echo "<td>".user_share_settings($var['shareAFPEnabled'], $sec_afp[$name])."</td>";
|
||||
$cmd="/webGui/scripts/share_size"."&arg1=".urlencode($name)."&arg2=ssz1";
|
||||
$cache = ucfirst($share['useCache']);
|
||||
if (array_key_exists($name, $ssz1)) {
|
||||
echo "<td>$cache</td>";
|
||||
echo "<td>".my_scale($ssz1[$name]['disk.total']*1024, $unit)." $unit</td>";
|
||||
echo "<td>".my_scale($share['free']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='$path/Browse?dir=/mnt/user/".urlencode($name)."'><img src='/webGui/images/explore.png' title='Browse /mnt/user/".urlencode($name)."'></a></td>";
|
||||
@@ -107,12 +109,14 @@ foreach ($shares as $name => $share) {
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td class='share-$row-1'>".my_scale($disksize*1024, $unit)." $unit</td>";
|
||||
echo "<td class='share-$row-2'>".my_scale($disks[$diskname]['fsFree']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' title='Recompute...' onclick='$.cookie(\"ssz\",\"ssz\",{path:\"/\"});$(\".share-$row-1\").html(\"Please wait...\");$(\".share-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
} else {
|
||||
echo "<td>$cache</td>";
|
||||
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' onclick=\"$.cookie('ssz','ssz',{path:'/'});$(this).text('Please wait...')\">Compute...</a></td>";
|
||||
echo "<td>".my_scale($share['free']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='$path/Browse?dir=/mnt/user/".urlencode($name)."'><img src='/webGui/images/explore.png' title='Browse /mnt/user/".urlencode($name)."'></a></td>";
|
||||
@@ -120,5 +124,5 @@ foreach ($shares as $name => $share) {
|
||||
}
|
||||
}
|
||||
if ($row==0) {
|
||||
echo "<tr><td colspan='8' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>There are no exportable user shares</td></tr>";
|
||||
echo "<tr><td colspan='9' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>There are no exportable user shares</td></tr>";
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ fi
|
||||
[[ -z $USE_TELNET ]] && USE_TELNET=yes
|
||||
[[ -z $PORTTELNET ]] && PORTTELNET=23
|
||||
[[ -z $USE_SSH ]] && USE_SSH=yes
|
||||
[[ -z $USE_UPNP ]] && USE_UPNP=yes
|
||||
[[ -z $PORTSSH ]] && PORTSSH=22
|
||||
|
||||
# get management IP addresses
|
||||
@@ -57,6 +58,13 @@ else
|
||||
/etc/rc.d/rc.sshd stop >/dev/null
|
||||
fi
|
||||
|
||||
# enable/disable UPnP function
|
||||
if [[ $USE_UPNP == yes ]]; then
|
||||
[[ ! -x /usr/bin/upnpc ]] && chmod +x /usr/bin/upnpc
|
||||
else
|
||||
[[ -x /usr/bin/upnpc ]] && chmod -x /usr/bin/upnpc
|
||||
fi
|
||||
|
||||
# update TELNET listening port
|
||||
sed -ri "s/^(telnet\s+)[0-9]+\/(tcp|udp)\$/\1${PORTTELNET}\/\2/" $SERV
|
||||
|
||||
|
||||
Reference in New Issue
Block a user