Edit User: fix share access assignments

This commit is contained in:
bergware
2020-01-05 15:06:26 +01:00
parent c45ea69f7d
commit e1e835451d
+9 -7
View File
@@ -184,12 +184,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);},3000);});
@@ -203,6 +203,8 @@ function updateAccess(form,data,n,i) {
$(form).find('select').each(function(){
if ($(this).prop('id')) {
var share = decodeURI($(this).prop('id'));
var read = readList[share].split(',');
var write = writeList[share].split(',');
var access = '';
data[i] = {};
data[i]['shareName'] = share;
@@ -214,12 +216,12 @@ function updateAccess(form,data,n,i) {
access = '<?=$rw?>';
break;
case 'secure':
if (','+user+',' == name) access = $(this).val();
else access = writeList[share].indexOf(name)!==-1 ? '<?=$rw?>' : '<?=$ro?>';
if (user == name) access = $(this).val();
else access = write.includes(user) ? '<?=$rw?>' : '<?=$ro?>';
break;
case 'private':
if (','+user+',' == name) access = $(this).val();
else access = writeList[share].indexOf(name)!==-1 ? '<?=$rw?>' : (readList[share].indexOf(name)!==-1 ? '<?=$ro?>' : '<?=$no?>');
if (user == name) access = $(this).val();
else access = write.includes(user) ? '<?=$rw?>' : (read.includes(user) ? '<?=$ro?>' : '<?=$no?>');
break;
}
data[i]['userAccess.'+idx] = access;