Files
webgui/plugins/dynamix/NewPerms.page

80 lines
2.8 KiB
Plaintext

Menu="UNRAID-OS"
Title="New Permissions"
---
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2012-2016, 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,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
function data_disks($disk) {
return ($disk['type']=='Data' && $disk['status']=='DISK_OK');
}
?>
<script>
function setNewPerms(form) {
var disks = '';
var all = form.includeDisk.options[0].selected;
for (var i=1,item; item=form.includeDisk.options[i]; i++) {
if (item.selected) {
if (disks.length) disks += '|';
if (!all) disks += item.value;
item.selected = false;
}
}
if (all||disks) openBox('/webGui/scripts/newperms&arg1='+disks,'New Permissions',490,430);
}
$(function() {
$('#s1').dropdownchecklist({emptyText:'None', width:131, firstItemChecksAll:true, explicitClose:'...close'});
<?if ($var['fsState']!="Started"):?>
$('#s1').dropdownchecklist('disable');
<?endif;?>
});
</script>
This is a one-time action to be taken after upgrading from a pre-5.0 unRAID server
release to version 5.0. It is also useful for restoring default ownership/permissions on files and
directories when transitioning back from Active Directory to non-Active Directory integration.
This utility starts a background process that goes to each of your data disks and cache disk
and changes file and directory ownership to nobody/users (i.e., uid/gid to 99/100), and sets permissions
as follows:
~~~
For directories:
drwxrwxrwx
For read/write files:
-rw-rw-rw-
For readonly files:
-r--r--r--
~~~
Clicking **Start** will open another window and start the background process.
Closing the window before completion will terminate the background process - so don't do that. This process can take a long time if you have many files.
<form method="POST" action="/update.htm" target="progressFrame" onsubmit="setNewPerms(this);return false">
<select id="s1" name="includeDisk" size="1" multiple="multiple" style="display:none">
<option value=''>All</option>
<?if (isset($disks['cache'])):?>
<option value='/mnt/cache' selected>Cache</option>
<?endif;?>
<?foreach (array_filter($disks,'data_disks') as $disk):?>
<?=mk_option(0,"/mnt/{$disk['name']}",my_disk($disk['name']))?>
<?endforeach;?>
</select>&nbsp;&nbsp;
<input type="submit" name="start" value="Start" disabled><input type="button" value=" Done " onclick="done()">
<?if ($var['fsState']!="Started"):?>
Array must be <strong>STARTED</strong> to change permissions.
<?else:?>
<input type="checkbox" onClick="start.disabled=!this.checked"><small>Yes I want to do this</small>
<?endif;?>
</form>