예제 #1
0
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
*/
OC_Util::checkAdminUser();
OCP\Util::addScript('files_external', 'settings');
OCP\Util::addscript('3rdparty', 'chosen/chosen.jquery.min');
OCP\Util::addStyle('files_external', 'settings');
OCP\Util::addStyle('3rdparty', 'chosen/chosen');
$backends = OC_Mount_Config::getBackends();
$personal_backends = array();
$enabled_backends = explode(',', OCP\Config::getAppValue('files_external', 'user_mounting_backends', ''));
foreach ($backends as $class => $backend) {
    if ($class != '\\OC\\Files\\Storage\\Local') {
        $personal_backends[$class] = array('backend' => $backend['backend'], 'enabled' => in_array($class, $enabled_backends));
    }
}
$tmpl = new OCP\Template('files_external', 'settings');
$tmpl->assign('isAdminPage', true);
$tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints());
$tmpl->assign('backends', $backends);
$tmpl->assign('personal_backends', $personal_backends);
$tmpl->assign('groups', OC_Group::getGroups());
$tmpl->assign('users', OCP\User::getUsers());
$tmpl->assign('userDisplayNames', OC_User::getDisplayNames());
$tmpl->assign('dependencies', OC_Mount_Config::checkDependencies());
$tmpl->assign('allowUserMounting', OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes'));
return $tmpl->fetchPage();
예제 #2
0
 /**
  * Get data to build the line chart about last 7 days used space evolution
  */
 public static function getUsedSpaceOverTime($time)
 {
     $return = array();
     if (OC_Group::inGroup(OCP\User::getUser(), 'admin')) {
         foreach (OCP\User::getUsers() as $user) {
             if (strcmp($time, 'daily') == 0) {
                 $return[$user] = self::getDataByUserToLineChart($user);
             } else {
                 $return[$user] = self::getDataByUserToHistoChart($user);
             }
         }
     } else {
         if (strcmp($time, 'daily') == 0) {
             $return[OCP\User::getUser()] = self::getDataByUserToLineChart(OCP\User::getUser());
         } else {
             $return[OCP\User::getUser()] = self::getDataByUserToHistoChart(OCP\User::getUser());
         }
     }
     return $return;
 }
예제 #3
0
 /**
  * Add a mount point to the filesystem
  * @param string Mount point
  * @param string Backend class
  * @param array Backend parameters for the class
  * @param string MOUNT_TYPE_GROUP | MOUNT_TYPE_USER
  * @param string User or group to apply mount to
  * @param bool Personal or system mount point i.e. is this being called from the personal or admin page
  * @return bool
  */
 public static function addMountPoint($mountPoint, $class, $classOptions, $mountType, $applicable, $isPersonal = false)
 {
     if ($isPersonal) {
         // Verify that the mount point applies for the current user
         // Prevent non-admin users from mounting local storage
         if ($applicable != OCP\User::getUser() || $class == 'OC_Filestorage_Local') {
             return false;
         }
         $view = new OC_FilesystemView('/' . OCP\User::getUser() . '/files');
         self::addMountPointDirectory($view, ltrim($mountPoint, '/'));
         $mountPoint = '/' . $applicable . '/files/' . ltrim($mountPoint, '/');
     } else {
         $view = new OC_FilesystemView('/');
         switch ($mountType) {
             case 'user':
                 if ($applicable == "all") {
                     $users = OCP\User::getUsers();
                     foreach ($users as $user) {
                         $path = $user . '/files/' . ltrim($mountPoint, '/');
                         self::addMountPointDirectory($view, $path);
                     }
                 } else {
                     $path = $applicable . '/files/' . ltrim($mountPoint, '/');
                     self::addMountPointDirectory($view, $path);
                 }
                 break;
             case 'group':
                 $groupMembers = OC_Group::usersInGroups(array($applicable));
                 foreach ($groupMembers as $user) {
                     $path = $user . '/files/' . ltrim($mountPoint, '/');
                     self::addMountPointDirectory($view, $path);
                 }
                 break;
         }
         $mountPoint = '/$user/files/' . ltrim($mountPoint, '/');
     }
     $mount = array($applicable => array($mountPoint => array('class' => $class, 'options' => $classOptions)));
     $mountPoints = self::readData($isPersonal);
     // Merge the new mount point into the current mount points
     if (isset($mountPoints[$mountType])) {
         if (isset($mountPoints[$mountType][$applicable])) {
             $mountPoints[$mountType][$applicable] = array_merge($mountPoints[$mountType][$applicable], $mount[$applicable]);
         } else {
             $mountPoints[$mountType] = array_merge($mountPoints[$mountType], $mount);
         }
     } else {
         $mountPoints[$mountType] = $mount;
     }
     self::writeData($isPersonal, $mountPoints);
     return true;
 }
예제 #4
0
 /**
  * @brief get a list of all users in a group
  * @returns array with user ids
  */
 public function usersInGroup($gid)
 {
     if (!$this->configured) {
         return array();
     }
     if (isset($this->_group_users[$gid])) {
         return $this->_group_users[$gid];
     }
     $groupDN = OC_LDAP::groupname2dn($gid);
     if (!$groupDN) {
         $this->_group_users[$gid] = array();
         return array();
     }
     $members = OC_LDAP::readAttribute($groupDN, $this->ldapGroupMemberAssocAttr);
     if (!$members) {
         $this->_group_users[$gid] = array();
         return array();
     }
     $result = array();
     $isMemberUid = strtolower($this->ldapGroupMemberAssocAttr) == 'memberuid';
     foreach ($members as $member) {
         if ($isMemberUid) {
             $filter = str_replace('%uid', $member, OC_LDAP::conf('ldapLoginFilter'));
             $ldap_users = OC_LDAP::fetchListOfUsers($filter, 'dn');
             if (count($ldap_users) < 1) {
                 continue;
             }
             $result[] = OC_LDAP::dn2username($ldap_users[0]);
             continue;
         } else {
             $result[] = OC_LDAP::dn2username($member);
         }
     }
     if (!$isMemberUid) {
         $result = array_intersect($result, OCP\User::getUsers());
     }
     $this->_group_users[$gid] = array_unique($result, SORT_LOCALE_STRING);
     return $this->_group_users[$gid];
 }
예제 #5
0
}
?>
					</table>
				</div>
			</td>
			<td>
				<div class="scroll_div_dialog">
					<table id="table_users">
						<tr>
							<th><?php 
p($l->t('Users'));
?>
</th>
						</tr>
						<?php 
$users = OCP\User::getUsers();
?>
						<?php 
foreach ($users as $uid) {
    ?>
							<tr>
								<td class="cl_user_item" id="user_<?php 
    echo $uid;
    ?>
" ><?php 
    echo OCP\User::getDisplayName($uid);
    ?>
</td>
							</tr>
						<?php 
}
예제 #6
0
* License as published by the Free Software Foundation; either 
* version 3 of the License, or any later version.
* 
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkLoggedIn();
$l = new OC_L10N('storagecharts2');
// build user list
$uids = OCP\User::getUsers();
$users = array();
foreach ($uids as $user) {
    array_push($users, '{"name":"' . $user . '","displayName":"' . OCP\User::getDisplayName($user) . '"}');
}
if (array_key_exists('s', $_POST) && array_key_exists('k', $_POST) && is_numeric($_POST['s']) && in_array($_POST['k'], array('hu_size', 'hu_size_hus', 'hu_ratio'))) {
    // Update and save the new configuration
    OC_DLStCharts::setUConfValue($_POST['k'], $_POST['s']);
    switch ($_POST['k']) {
        case 'hu_size':
            OCP\JSON::encodedPrint(array('data' => array('chart' => OC_DLStChartsLoader::loadChart('chisto_us', $l), 'users' => $users)));
            break;
        case 'hu_size_hus':
            OCP\JSON::encodedPrint(array('data' => array('chart' => OC_DLStChartsLoader::loadChart('clines_usse', $l), 'users' => $users)));
            break;
    }