当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthService::listUsers方法代码示例

本文整理汇总了PHP中AuthService::listUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthService::listUsers方法的具体用法?PHP AuthService::listUsers怎么用?PHP AuthService::listUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AuthService的用法示例。


在下文中一共展示了AuthService::listUsers方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteGroup

 public function deleteGroup($groupPath)
 {
     $gUsers = AuthService::listUsers($groupPath);
     $gGroups = AuthService::listChildrenGroups($groupPath);
     if (count($gUsers) || count($gGroups)) {
         throw new Exception("Group is not empty, please do something with its content before trying to delete it!");
     }
     $groups = AJXP_Utils::loadSerialFile(AJXP_VarsFilter::filter($this->getOption("USERS_DIRPATH")) . "/groups.ser");
     foreach ($groups as $key => $value) {
         if ($value == $groupPath) {
             unset($groups[$key]);
         }
     }
     AJXP_Utils::saveSerialFile(AJXP_VarsFilter::filter($this->getOption("USERS_DIRPATH")) . "/groups.ser", $groups);
 }
开发者ID:biggtfish,项目名称:cms,代码行数:15,代码来源:class.serialConfDriver.php

示例2: listRepositories

 function listRepositories()
 {
     $repos = ConfService::getRepositoriesList();
     AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="ajxp_conf.9" attributeName="accessType" sortType="String"/><column messageId="ajxp_shared.9" attributeName="repo_accesses" sortType="String"/></columns>');
     $repoArray = array();
     $childRepos = array();
     $loggedUser = AuthService::getLoggedUser();
     $users = AuthService::listUsers();
     foreach ($repos as $repoIndex => $repoObject) {
         if ($repoObject->getAccessType() == "ajxp_conf") {
             continue;
         }
         if (!$repoObject->hasOwner() || $repoObject->getOwner() != $loggedUser->getId()) {
             continue;
         }
         if (is_numeric($repoIndex)) {
             $repoIndex = "" . $repoIndex;
         }
         $name = AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay()));
         $repoArray[$name] = $repoIndex;
     }
     // Sort the list now by name
     ksort($repoArray);
     // Append child repositories
     $sortedArray = array();
     foreach ($repoArray as $name => $repoIndex) {
         $sortedArray[$name] = $repoIndex;
         if (isset($childRepos[$repoIndex]) && is_array($childRepos[$repoIndex])) {
             foreach ($childRepos[$repoIndex] as $childData) {
                 $sortedArray[$childData["name"]] = $childData["index"];
             }
         }
     }
     foreach ($sortedArray as $name => $repoIndex) {
         $repoObject =& $repos[$repoIndex];
         $repoAccesses = array();
         foreach ($users as $userId => $userObject) {
             if (!$userObject->hasParent()) {
                 continue;
             }
             if ($userObject->canWrite($repoIndex)) {
                 $repoAccesses[] = $userId . " (rw)";
             } else {
                 if ($userObject->canRead($repoIndex)) {
                     $repoAccesses[] = $userId . " (r)";
                 }
             }
         }
         $metaData = array("repository_id" => $repoIndex, "accessType" => $repoObject->getAccessType(), "icon" => "document_open_remote.png", "openicon" => "document_open_remote.png", "parentname" => "/repositories", "repo_accesses" => implode(", ", $repoAccesses), "ajxp_mime" => "shared_repository");
         AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
     }
 }
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:52,代码来源:class.ajxpSharedAccessDriver.php

示例3: listUsers

    function listUsers()
    {
        print '<columns switchGridMode="filelist"><column messageString="User Name" attributeName="ajxp_label" sortType="String"/><column messageString="Is Admin" attributeName="isAdmin" sortType="String"/></columns>';
        if (!ENABLE_USERS) {
            return;
        }
        $users = AuthService::listUsers();
        $loggedUser = AuthService::getLoggedUser();
        $userArray = array();
        foreach ($users as $userObject) {
            $userArray[Utils::xmlEntities($userObject->getId())] = $userObject;
        }
        ksort($userArray);
        foreach ($userArray as $userObject) {
            $isAdmin = $userObject->isAdmin();
            $userId = Utils::xmlEntities($userObject->getId());
            $icon = "user" . ($userId == "guest" ? "_guest" : ($isAdmin ? "_admin" : ""));
            print '<tree 
				text="' . $userId . '"
				isAdmin="' . ($isAdmin ? "True" : "False") . '" 
				icon="' . $icon . '.png" 
				openicon="' . $icon . '.png" 
				filename="/users/' . $userId . '" 
				parentname="/users" 
				is_file="1" 
				ajxp_mime="user' . ($userId != "guest" && $userId != $loggedUser->getId() ? "_editable" : "") . '"
				/>';
        }
    }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:29,代码来源:class.ajxp_confAccessDriver.php

示例4: listUsers

 public function listUsers($root, $child, $hashValue = null, $returnNodes = false, $findNodePosition = null)
 {
     $USER_PER_PAGE = 50;
     if ($root == "users") {
         $baseGroup = "/";
     } else {
         $baseGroup = substr($root, strlen("users"));
     }
     if ($findNodePosition != null && $hashValue == null) {
         // Add groups offset
         $groups = AuthService::listChildrenGroups($baseGroup);
         $offset = 0;
         if (count($groups)) {
             $offset = count($groups);
         }
         $position = AuthService::findUserPage($baseGroup, $findNodePosition, $USER_PER_PAGE);
         if ($position != -1) {
             $key = "/data/" . $root . "/" . $findNodePosition;
             $data = array($key => AJXP_XMLWriter::renderNode($key, $findNodePosition, true, array("page_position" => $position), true, false));
             return $data;
         } else {
             // Loop on each page to find the correct page.
             $count = AuthService::authCountUsers($baseGroup);
             $pages = ceil($count / $USER_PER_PAGE);
             for ($i = 0; $i < $pages; $i++) {
                 $tests = $this->listUsers($root, $child, $i + 1, true, $findNodePosition);
                 if (is_array($tests) && isset($tests["/data/" . $root . "/" . $findNodePosition])) {
                     return array("/data/" . $root . "/" . $findNodePosition => str_replace("ajxp_mime", "page_position='" . ($i + 1) . "' ajxp_mime", $tests["/data/" . $root . "/" . $findNodePosition]));
                 }
             }
         }
         return array();
     }
     $allNodes = array();
     $columns = '<columns switchDisplayMode="list" switchGridMode="filelist" template_name="ajxp_conf.users">
                 <column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
                 <column messageId="ajxp_conf.102" attributeName="object_id" sortType="String" defaultWidth="10%"/>
                 <column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="10%"/>
                 <column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
                 <column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
                 </columns>';
     if (AuthService::driverSupportsAuthSchemes()) {
         $columns = '<columns switchDisplayMode="list" switchGridMode="filelist" template_name="ajxp_conf.users_authscheme">
                     <column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
                     <column messageId="ajxp_conf.102" attributeName="object_id" sortType="String" defaultWidth="10%"/>
                     <column messageId="ajxp_conf.115" attributeName="auth_scheme" sortType="String" defaultWidth="5%"/>
                     <column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="5%"/>
                     <column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
                     <column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
         </columns>';
     }
     if (!$returnNodes) {
         AJXP_XMLWriter::sendFilesListComponentConfig($columns);
     }
     if (!AuthService::usersEnabled()) {
         return array();
     }
     if (empty($hashValue)) {
         $hashValue = 1;
     }
     $count = AuthService::authCountUsers($baseGroup, "", null, null, false);
     if (AuthService::authSupportsPagination() && $count >= $USER_PER_PAGE) {
         $offset = ($hashValue - 1) * $USER_PER_PAGE;
         if (!$returnNodes) {
             AJXP_XMLWriter::renderPaginationData($count, $hashValue, ceil($count / $USER_PER_PAGE));
         }
         $users = AuthService::listUsers($baseGroup, "", $offset, $USER_PER_PAGE, true, false);
         if ($hashValue == 1) {
             $groups = AuthService::listChildrenGroups($baseGroup);
         } else {
             $groups = array();
         }
     } else {
         $users = AuthService::listUsers($baseGroup, "", -1, -1, true, false);
         $groups = AuthService::listChildrenGroups($baseGroup);
     }
     foreach ($groups as $groupId => $groupLabel) {
         $nodeKey = "/data/" . $root . "/" . ltrim($groupId, "/");
         $meta = array("icon" => "users-folder.png", "ajxp_mime" => "group", "object_id" => $groupId);
         if (in_array($nodeKey, $this->currentBookmarks)) {
             $meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
         }
         $xml = AJXP_XMLWriter::renderNode($nodeKey, $groupLabel, false, $meta, true, false);
         if (!$returnNodes) {
             print $xml;
         } else {
             $allNodes[$nodeKey] = $xml;
         }
     }
     $mess = ConfService::getMessages();
     $loggedUser = AuthService::getLoggedUser();
     $userArray = array();
     foreach ($users as $userObject) {
         $label = $userObject->getId();
         if ($userObject->hasParent()) {
             $label = $userObject->getParent() . "000" . $label;
         } else {
             $children = ConfService::getConfStorageImpl()->getUserChildren($label);
             foreach ($children as $addChild) {
                 $userArray[$label . "000" . $addChild->getId()] = $addChild;
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.ajxp_confAccessDriver.php

示例5: switchAction


//.........这里部分代码省略.........
                 throw new Exception("You are not allowed to edit this user");
             }
             AuthService::deleteUser($userId);
             echo "SUCCESS";
             break;
         case "user_list_authorized_users":
             $defaultFormat = "html";
             HTMLWriter::charsetHeader();
             if (!ConfService::getAuthDriverImpl()->usersEditable()) {
                 break;
             }
             $loggedUser = AuthService::getLoggedUser();
             $crtValue = $httpVars["value"];
             $usersOnly = isset($httpVars["users_only"]) && $httpVars["users_only"] == "true";
             $existingOnly = isset($httpVars["existing_only"]) && $httpVars["existing_only"] == "true";
             if (!empty($crtValue)) {
                 $regexp = '^' . $crtValue;
             } else {
                 $regexp = null;
             }
             $skipDisplayWithoutRegexp = ConfService::getCoreConf("USERS_LIST_REGEXP_MANDATORY", "conf");
             if ($skipDisplayWithoutRegexp && $regexp == null) {
                 print "<ul></ul>";
                 break;
             }
             $limit = intval(ConfService::getCoreConf("USERS_LIST_COMPLETE_LIMIT", "conf"));
             $searchAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf");
             $displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
             $baseGroup = "/";
             if ($regexp == null && !$displayAll || $regexp != null && !$searchAll) {
                 $baseGroup = AuthService::filterBaseGroup("/");
             }
             AuthService::setGroupFiltering(false);
             $allUsers = AuthService::listUsers($baseGroup, $regexp, 0, $limit, false);
             if (!$usersOnly) {
                 $allGroups = array();
                 $roleOrGroup = ConfService::getCoreConf("GROUP_OR_ROLE", "conf");
                 $rolePrefix = $excludeString = $includeString = null;
                 if (!is_array($roleOrGroup)) {
                     $roleOrGroup = array("group_switch_value" => $roleOrGroup);
                 }
                 $listRoleType = false;
                 if (isset($roleOrGroup["PREFIX"])) {
                     $rolePrefix = $loggedUser->mergedRole->filterParameterValue("core.conf", "PREFIX", null, $roleOrGroup["PREFIX"]);
                     $excludeString = $loggedUser->mergedRole->filterParameterValue("core.conf", "EXCLUDED", null, $roleOrGroup["EXCLUDED"]);
                     $includeString = $loggedUser->mergedRole->filterParameterValue("core.conf", "INCLUDED", null, $roleOrGroup["INCLUDED"]);
                     $listUserRolesOnly = $loggedUser->mergedRole->filterParameterValue("core.conf", "LIST_ROLE_BY", null, $roleOrGroup["LIST_ROLE_BY"]);
                     if (is_array($listUserRolesOnly) && isset($listUserRolesOnly["group_switch_value"])) {
                         switch ($listUserRolesOnly["group_switch_value"]) {
                             case "userroles":
                                 $listRoleType = true;
                                 break;
                             case "allroles":
                                 $listRoleType = false;
                                 break;
                             default:
                                 break;
                         }
                     }
                 }
                 switch (strtolower($roleOrGroup["group_switch_value"])) {
                     case 'user':
                         // donothing
                         break;
                     case 'group':
                         $authGroups = AuthService::listChildrenGroups($baseGroup);
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:67,代码来源:class.AbstractConfDriver.php

示例6: listUsers

 function listUsers($root, $child, $hashValue = null)
 {
     $columns = '<columns switchGridMode="filelist" template_name="ajxp_conf.users">
     			<column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
     			<column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="10%"/>
     			<column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
     			<column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
     			</columns>';
     if (AuthService::driverSupportsAuthSchemes()) {
         $columns = '<columns switchGridMode="filelist" template_name="ajxp_conf.users">
         			<column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
         			<column messageId="ajxp_conf.115" attributeName="auth_scheme" sortType="String" defaultWidth="5%"/>
         			<column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="5%"/>
         			<column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
         			<column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
         </columns>';
     }
     AJXP_XMLWriter::sendFilesListComponentConfig($columns);
     if (!AuthService::usersEnabled()) {
         return;
     }
     $count = AuthService::authCountUsers();
     $USER_PER_PAGE = 50;
     if (empty($hashValue)) {
         $hashValue = 1;
     }
     if (AuthService::authSupportsPagination() && $count > $USER_PER_PAGE) {
         $offset = ($hashValue - 1) * $USER_PER_PAGE;
         AJXP_XMLWriter::renderPaginationData($count, $hashValue, ceil($count / $USER_PER_PAGE));
         $users = AuthService::listUsers("", $offset, $USER_PER_PAGE);
     } else {
         $users = AuthService::listUsers();
     }
     $mess = ConfService::getMessages();
     $repos = ConfService::getRepositoriesList();
     $loggedUser = AuthService::getLoggedUser();
     $userArray = array();
     foreach ($users as $userIndex => $userObject) {
         $label = $userObject->getId();
         if ($userObject->hasParent()) {
             $label = $userObject->getParent() . "000" . $label;
         }
         $userArray[$label] = $userObject;
     }
     ksort($userArray);
     foreach ($userArray as $userObject) {
         $isAdmin = $userObject->isAdmin();
         $userId = $userObject->getId();
         $icon = "user" . ($userId == "guest" ? "_guest" : ($isAdmin ? "_admin" : ""));
         if ($userObject->hasParent()) {
             $icon = "user_child";
         }
         $rightsString = "";
         if ($isAdmin) {
             $rightsString = $mess["ajxp_conf.63"];
         } else {
             $r = array();
             foreach ($repos as $repoId => $repository) {
                 if ($repository->getAccessType() == "ajxp_shared") {
                     continue;
                 }
                 if (!$userObject->canRead($repoId) && !$userObject->canWrite($repoId)) {
                     continue;
                 }
                 $rs = $userObject->canRead($repoId) ? "r" : "";
                 $rs .= $userObject->canWrite($repoId) ? "w" : "";
                 $r[] = $repository->getDisplay() . " (" . $rs . ")";
             }
             $rightsString = implode(", ", $r);
         }
         $nodeLabel = $userId;
         $scheme = AuthService::getAuthScheme($userId);
         AJXP_XMLWriter::renderNode("/users/" . $userId, $nodeLabel, true, array("isAdmin" => $mess[$isAdmin ? "ajxp_conf.14" : "ajxp_conf.15"], "icon" => $icon . ".png", "auth_scheme" => $scheme != null ? $scheme : "", "rights_summary" => $rightsString, "ajxp_roles" => implode(", ", array_keys($userObject->getRoles())), "ajxp_mime" => "user" . ($userId != "guest" && $userId != $loggedUser->getId() ? "_editable" : "")));
     }
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:75,代码来源:class.ajxp_confAccessDriver.php

示例7: decodeUserPassword

 /** Decode a user supplied password before using it */
 function decodeUserPassword($password)
 {
     if (function_exists('mcrypt_decrypt')) {
         $users = AuthService::listUsers();
         // The initialisation vector is only required to avoid a warning, as ECB ignore IV
         $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
         // We have encoded as base64 so if we need to store the result in a database, it can be stored in text column
         $password = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($this->getId() . "CDAFx¨op#"), base64_decode($password), MCRYPT_MODE_ECB, $iv));
     }
     return $password;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:12,代码来源:class.AbstractAjxpUser.php

示例8: gatherUsers

 protected function gatherUsers(&$users, $startGroup = "/")
 {
     $u = AuthService::listUsers($startGroup);
     $users = array_merge($users, array_keys($u));
     $g = AuthService::listChildrenGroups($startGroup);
     if (count($g)) {
         foreach ($g as $gName => $gLabel) {
             $this->gatherUsers($users, $startGroup . $gName);
         }
     }
 }
开发者ID:biggtfish,项目名称:cms,代码行数:11,代码来源:class.AjxpScheduler.php

示例9: listRepositories

 public function listRepositories()
 {
     AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="user_dash.9" attributeName="parent_label" sortType="String"/><column messageId="user_dash.9" attributeName="repo_accesses" sortType="String"/></columns>');
     $repoArray = array();
     $loggedUser = AuthService::getLoggedUser();
     $count = 0;
     $repos = ConfService::listRepositoriesWithCriteria(array("owner_user_id" => $loggedUser->getId()), $count);
     $searchAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf");
     $displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
     if ($searchAll || $displayAll) {
         $baseGroup = "/";
     } else {
         $baseGroup = AuthService::filterBaseGroup("/");
     }
     AuthService::setGroupFiltering(false);
     $users = AuthService::listUsers($baseGroup);
     $minisites = $this->listSharedFiles("minisites");
     foreach ($repos as $repoIndex => $repoObject) {
         if ($repoObject->getAccessType() == "ajxp_conf") {
             continue;
         }
         if (!$repoObject->hasOwner() || $repoObject->getOwner() != $loggedUser->getId()) {
             continue;
         }
         if (is_numeric($repoIndex)) {
             $repoIndex = "" . $repoIndex;
         }
         $name = (isset($minisites[$repoIndex]) ? "[Minisite] " : "") . AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay()));
         $repoArray[$name] = $repoIndex;
     }
     // Sort the list now by name
     ksort($repoArray);
     foreach ($repoArray as $name => $repoIndex) {
         $repoObject =& $repos[$repoIndex];
         $repoAccesses = array();
         foreach ($users as $userId => $userObject) {
             if ($userObject->getId() == $loggedUser->getId()) {
                 continue;
             }
             $label = $userObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $userId);
             if (empty($label)) {
                 $label = $userId;
             }
             $acl = $userObject->mergedRole->getAcl($repoObject->getId());
             if (!empty($acl)) {
                 $repoAccesses[] = $label . " (" . $acl . ")";
             }
         }
         $parent = $repoObject->getParentId();
         $parentRepo =& $repos[$parent];
         $parentLabel = $this->metaIcon("folder-open") . $parentRepo->getDisplay();
         $repoPath = $repoObject->getOption("PATH");
         $parentPath = $parentRepo->getOption("PATH");
         $parentLabel .= " (" . str_replace($parentPath, "", $repoPath) . ")";
         $metaData = array("repository_id" => $repoIndex, "icon" => "document_open_remote.png", "openicon" => "document_open_remote.png", "parentname" => "/repositories", "parent_label" => $parentLabel, "repo_accesses" => count($repoAccesses) ? $this->metaIcon("share-sign") . implode(", ", $repoAccesses) : "", "ajxp_mime" => "shared_repository");
         AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:58,代码来源:class.UserDashboardDriver.php

示例10: listUsers

    function listUsers()
    {
        AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist">
			<column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String"/>
			<column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String"/>
			<column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String"/>
			<column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String"/>
			</columns>');
        if (!ENABLE_USERS) {
            return;
        }
        $users = AuthService::listUsers();
        $mess = ConfService::getMessages();
        $repos = ConfService::getRepositoriesList();
        $loggedUser = AuthService::getLoggedUser();
        $userArray = array();
        foreach ($users as $userIndex => $userObject) {
            $label = $userObject->getId();
            if ($userObject->hasParent()) {
                $label = $userObject->getParent() . "000" . $label;
            }
            $userArray[$label] = $userObject;
        }
        ksort($userArray);
        foreach ($userArray as $userObject) {
            $isAdmin = $userObject->isAdmin();
            $userId = AJXP_Utils::xmlEntities($userObject->getId());
            $icon = "user" . ($userId == "guest" ? "_guest" : ($isAdmin ? "_admin" : ""));
            if ($userObject->hasParent()) {
                $icon = "user_child";
            }
            $rightsString = "";
            if ($isAdmin) {
                $rightsString = $mess["ajxp_conf.63"];
            } else {
                $r = array();
                foreach ($repos as $repoId => $repository) {
                    if ($repository->getAccessType() == "ajxp_shared") {
                        continue;
                    }
                    if ($userObject->canWrite($repoId)) {
                        $r[] = $repository->getDisplay() . " (rw)";
                    } else {
                        if ($userObject->canRead($repoId)) {
                            $r[] = $repository->getDisplay() . " (r)";
                        }
                    }
                }
                $rightsString = implode(", ", $r);
            }
            AJXP_XMLWriter::renderNode("/users/" . $userId, $userId, true, array("isAdmin" => $mess[$isAdmin ? "ajxp_conf.14" : "ajxp_conf.15"], "icon" => $icon . ".png", "rights_summary" => AJXP_Utils::xmlEntities($rightsString, true), "ajxp_roles" => implode(", ", array_keys($userObject->getRoles())), "ajxp_mime" => "user" . ($userId != "guest" && $userId != $loggedUser->getId() ? "_editable" : "")));
        }
    }
开发者ID:pussbb,项目名称:CI_DEV_CMS,代码行数:53,代码来源:class.ajxp_confAccessDriver.php

示例11: switchAction


//.........这里部分代码省略.........
                         $errorMessage = "{$mess['33']} " . $userfile_name;
                         break;
                     }
                 }
                 $this->changeMode($destination . "/" . $userfile_name);
                 $logMessage .= "{$mess['34']} " . SystemTextEncoding::toUTF8($userfile_name) . " {$mess['35']} {$dir}";
                 AJXP_Logger::logAction("Upload File", array("file" => SystemTextEncoding::fromUTF8($dir) . "/" . $userfile_name));
             }
             if (isset($errorMessage)) {
                 AJXP_Logger::debug("Return error {$errorCode} {$errorMessage}");
                 return array("ERROR" => array("CODE" => $errorCode, "MESSAGE" => $errorMessage));
             } else {
                 AJXP_Logger::debug("Return success");
                 return array("SUCCESS" => true);
             }
             return;
             break;
             //------------------------------------
             // SHARING FILE OR FOLDER
             //------------------------------------
         //------------------------------------
         // SHARING FILE OR FOLDER
         //------------------------------------
         case "public_url":
             $subAction = isset($httpVars["sub_action"]) ? $httpVars["sub_action"] : "";
             if ($subAction == "delegate_repo") {
                 header("Content-type:text/plain");
                 $result = $this->createSharedRepository($httpVars);
                 print $result;
             } else {
                 if ($subAction == "list_shared_users") {
                     header("Content-type:text/html");
                     $loggedUser = AuthService::getLoggedUser();
                     $allUsers = AuthService::listUsers();
                     $crtValue = $httpVars["value"];
                     $users = "";
                     foreach ($allUsers as $userId => $userObject) {
                         if ($crtValue != "" && (strstr($userId, $crtValue) === false || strstr($userId, $crtValue) != 0)) {
                             continue;
                         }
                         if ($userObject->hasParent() && $userObject->getParent() == $loggedUser->getId()) {
                             $users .= "<li>" . $userId . "</li>";
                         }
                     }
                     if (strlen($users)) {
                         print "<ul>" . $users . "</ul>";
                     }
                 } else {
                     $file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
                     $url = $this->makePubliclet($file, $httpVars["password"], $httpVars["expiration"]);
                     header("Content-type:text/plain");
                     echo $url;
                 }
             }
             break;
             //------------------------------------
             //	XML LISTING
             //------------------------------------
         //------------------------------------
         //	XML LISTING
         //------------------------------------
         case "ls":
             if (!isset($dir) || $dir == "/") {
                 $dir = "";
             }
             $lsOptions = $this->parseLsOptions(isset($httpVars["options"]) ? $httpVars["options"] : "a");
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:67,代码来源:class.fsAccessDriver.php

示例12: switchAction

 function switchAction($action, $httpVars, $fileVars)
 {
     if (!isset($this->accessDriver)) {
         throw new Exception("Cannot find access driver!");
     }
     if ($this->accessDriver->getId() == "access.demo") {
         $errorMessage = "This is a demo, all 'write' actions are disabled!";
         if ($httpVars["sub_action"] == "delegate_repo") {
             return AJXP_XMLWriter::sendMessage(null, $errorMessage, false);
         } else {
             print $errorMessage;
         }
         return;
     }
     switch ($action) {
         //------------------------------------
         // SHARING FILE OR FOLDER
         //------------------------------------
         case "share":
             $subAction = isset($httpVars["sub_action"]) ? $httpVars["sub_action"] : "";
             if ($subAction == "delegate_repo") {
                 header("Content-type:text/plain");
                 $result = $this->createSharedRepository($httpVars, $this->repository, $this->accessDriver);
                 print $result;
             } else {
                 if ($subAction == "list_shared_users") {
                     header("Content-type:text/html");
                     if (!ConfService::getAuthDriverImpl()->usersEditable()) {
                         break;
                     }
                     $loggedUser = AuthService::getLoggedUser();
                     $crtValue = $httpVars["value"];
                     if (!empty($crtValue)) {
                         $regexp = '^' . preg_quote($crtValue);
                     } else {
                         $regexp = null;
                     }
                     $limit = min($this->pluginConf["SHARED_USERS_LIST_LIMIT"], 20);
                     $allUsers = AuthService::listUsers($regexp, 0, $limit, false);
                     $users = "";
                     $index = 0;
                     foreach ($allUsers as $userId => $userObject) {
                         if (!$userObject->hasParent() && ConfService::getCoreConf("ALLOW_CROSSUSERS_SHARING") || $userObject->getParent() == $loggedUser->getId()) {
                             if ($regexp != null && !preg_match("/{$regexp}/i", $userId)) {
                                 continue;
                             }
                             $users .= "<li>" . $userId . "</li>";
                             $index++;
                         }
                         if ($index == $limit) {
                             break;
                         }
                     }
                     if (strlen($users)) {
                         print "<ul>" . $users . "</ul>";
                     }
                 } else {
                     $file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
                     if (!isset($httpVars["downloadlimit"])) {
                         $httpVars["downloadlimit"] = 0;
                     }
                     $data = $this->accessDriver->makePublicletOptions($file, $httpVars["password"], $httpVars["expiration"], $httpVars["downloadlimit"], $this->repository);
                     $customData = array();
                     foreach ($httpVars as $key => $value) {
                         if (substr($key, 0, strlen("PLUGINS_DATA_")) == "PLUGINS_DATA_") {
                             $customData[substr($key, strlen("PLUGINS_DATA_"))] = $value;
                         }
                     }
                     if (count($customData)) {
                         $data["PLUGINS_DATA"] = $customData;
                     }
                     $url = $this->writePubliclet($data, $this->accessDriver, $this->repository);
                     if ($this->metaStore != null) {
                         $ar = explode(".", basename($url));
                         $this->metaStore->setMetadata(new AJXP_Node($this->urlBase . $file), "ajxp_shared", array("element" => array_shift($ar)), true, AJXP_METADATA_SCOPE_REPOSITORY);
                     }
                     header("Content-type:text/plain");
                     echo $url;
                 }
             }
             break;
         case "load_shared_element_data":
             $file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
             $elementType = $httpVars["element_type"];
             $messages = ConfService::getMessages();
             if ($this->metaStore != null) {
                 $metadata = $this->metaStore->retrieveMetadata(new AJXP_Node($this->urlBase . $file), "ajxp_shared", true, AJXP_METADATA_SCOPE_REPOSITORY);
             }
             if (count($metadata)) {
                 header("Content-type:application/json");
                 if ($elementType == "file") {
                     $pData = self::loadPublicletData($metadata["element"]);
                     if ($pData["OWNER_ID"] != AuthService::getLoggedUser()->getId()) {
                         throw new Exception("You are not allowed to access this data");
                     }
                     if (isset($metadata["short_form_url"])) {
                         $link = $metadata["short_form_url"];
                     } else {
                         $link = $this->buildPublicletLink($metadata["element"]);
                     }
//.........这里部分代码省略.........
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:101,代码来源:class.ShareCenter.php

示例13: listUsers

    function listUsers()
    {
        AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String"/><column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String"/></columns>');
        if (!ENABLE_USERS) {
            return;
        }
        $users = AuthService::listUsers();
        $mess = ConfService::getMessages();
        $loggedUser = AuthService::getLoggedUser();
        $userArray = array();
        foreach ($users as $userObject) {
            $userArray[AJXP_Utils::xmlEntities($userObject->getId())] = $userObject;
        }
        ksort($userArray);
        foreach ($userArray as $userObject) {
            $isAdmin = $userObject->isAdmin();
            $userId = AJXP_Utils::xmlEntities($userObject->getId());
            $icon = "user" . ($userId == "guest" ? "_guest" : ($isAdmin ? "_admin" : ""));
            print '<tree 
				text="' . $userId . '"
				isAdmin="' . $mess[$isAdmin ? "ajxp_conf.14" : "ajxp_conf.15"] . '" 
				icon="' . $icon . '.png" 
				openicon="' . $icon . '.png" 
				filename="/users/' . $userId . '" 
				parentname="/users" 
				is_file="1" 
				ajxp_mime="user' . ($userId != "guest" && $userId != $loggedUser->getId() ? "_editable" : "") . '"
				/>';
        }
    }
开发者ID:umbecr,项目名称:camilaframework,代码行数:30,代码来源:class.ajxp_confAccessDriver.php

示例14: runTask

 function runTask($taskId, $status = null, &$currentlyRunning = -1, $forceStart = false)
 {
     $data = $this->getTaskById($taskId);
     $mess = ConfService::getMessages();
     $timeArray = $this->getTimeArray($data["schedule"]);
     // TODO : Set MasterInterval as config, or detect last execution?
     $masterInterval = 1;
     $maximumProcesses = 2;
     $now = time();
     $lastExec = time() - 60 * $masterInterval;
     $res = $this->getNextExecutionTimeForScript($lastExec, $timeArray);
     $test = date("Y-m-d H:i", $lastExec) . " -- " . date("Y-m-d H:i", $res) . " --  " . date("Y-m-d H:i", $now);
     $alreadyRunning = false;
     $queued = false;
     if ($status == null) {
         $status = $this->getTaskStatus($taskId);
     }
     if ($status !== false) {
         if ($status[0] == "RUNNING") {
             $alreadyRunning = true;
         } else {
             if (in_array("QUEUED", $status)) {
                 $queued = true;
                 // Run now !
             }
         }
     }
     if ($res >= $lastExec && $res < $now && !$alreadyRunning && $currentlyRunning >= $maximumProcesses) {
         $this->setTaskStatus($taskId, "QUEUED", true);
         $alreadyRunning = true;
         $queued = false;
     }
     if ($res >= $lastExec && $res < $now && !$alreadyRunning || $queued || $forceStart) {
         if ($data["user_id"] == "*") {
             $data["user_id"] = implode(",", array_keys(AuthService::listUsers()));
         }
         if ($data["repository_id"] == "*") {
             $data["repository_id"] = implode(",", array_keys(ConfService::getRepositoriesList()));
         }
         $process = AJXP_Controller::applyActionInBackground($data["repository_id"], $data["action_name"], $data["PARAMS"], $data["user_id"], AJXP_CACHE_DIR . "/cmd_outputs/task_" . $taskId . ".status");
         if ($process != null && is_a($process, "UnixProcess")) {
             $this->setTaskStatus($taskId, "RUNNING:" . $process->getPid());
         } else {
             $this->setTaskStatus($taskId, "RUNNING");
         }
         $currentlyRunning++;
         return true;
     }
     return false;
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:50,代码来源:class.AjxpScheduler.php


注:本文中的AuthService::listUsers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。