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


PHP AuthService::countAdminUsers方法代码示例

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


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

示例1: bootSequence

 /**
  * Specific operations to perform at boot time
  * @static
  * @param array $START_PARAMETERS A HashTable of parameters to send back to the client
  * @return void
  */
 public static function bootSequence(&$START_PARAMETERS)
 {
     if (@file_exists(AJXP_CACHE_DIR . "/admin_counted")) {
         return;
     }
     $adminCount = AuthService::countAdminUsers();
     if ($adminCount == 0) {
         $authDriver = ConfService::getAuthDriverImpl();
         $adminPass = ADMIN_PASSWORD;
         if ($authDriver->getOption("TRANSMIT_CLEAR_PASS") !== true) {
             $adminPass = md5(ADMIN_PASSWORD);
         }
         AuthService::createUser("admin", $adminPass, true);
         if (ADMIN_PASSWORD == INITIAL_ADMIN_PASSWORD) {
             $START_PARAMETERS["ALERT"] .= "Warning! User 'admin' was created with the initial common password 'admin'. \\nPlease log in as admin and change the password now!";
         }
     } else {
         if ($adminCount == -1) {
             // Here we may come from a previous version! Check the "admin" user and set its right as admin.
             $confStorage = ConfService::getConfStorageImpl();
             $adminUser = $confStorage->createUserObject("admin");
             $adminUser->setAdmin(true);
             $adminUser->save("superuser");
             $START_PARAMETERS["ALERT"] .= "There is an admin user, but without admin right. Now any user can have the administration rights, \\n your 'admin' user was set with the admin rights. Please check that this suits your security configuration.";
         }
     }
     @file_put_contents(AJXP_CACHE_DIR . "/admin_counted", "true");
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:34,代码来源:class.AuthService.php

示例2: bootSequence

 public static function bootSequence(&$START_PARAMETERS)
 {
     if (!is_readable(USERS_DIR)) {
         $START_PARAMETERS["ALERT"] = "Warning, the users directory is not readable!";
     } else {
         if (!is_writeable(USERS_DIR)) {
             $START_PARAMETERS["ALERT"] = "Warning, the users directory is not writeable!";
         }
     }
     if (AuthService::countAdminUsers() == 0) {
         $authDriver = ConfService::getAuthDriverImpl();
         $adminPass = ADMIN_PASSWORD;
         if ($authDriver->getOption("TRANSMIT_CLEAR_PASS") !== true) {
             $adminPass = md5(ADMIN_PASSWORD);
         }
         AuthService::createUser("admin", $adminPass, true);
         if (ADMIN_PASSWORD == INITIAL_ADMIN_PASSWORD) {
             $START_PARAMETERS["ALERT"] .= "Warning! User 'admin' was created with the initial common password 'admin'. \\nPlease log in as admin and change the password now!";
         }
     } else {
         if (AuthService::countAdminUsers() == -1) {
             // Here we may come from a previous version! Check the "admin" user and set its right as admin.
             $confStorage = ConfService::getConfStorageImpl();
             $adminUser = $confStorage->createUserObject("admin");
             $adminUser->setAdmin(true);
             $adminUser->save();
             $START_PARAMETERS["ALERT"] .= "You may come from a previous version. Now any user can have the administration rights, \\n your 'admin' user was set with the admin rights. Please check that this suits your security configuration.";
         }
     }
 }
开发者ID:pussbb,项目名称:CI_DEV_CMS,代码行数:30,代码来源:class.AuthService.php

示例3: bootSequence

 /**
  * Specific operations to perform at boot time
  * @static
  * @param array $START_PARAMETERS A HashTable of parameters to send back to the client
  * @return void
  */
 public static function bootSequence(&$START_PARAMETERS)
 {
     if (AJXP_Utils::detectApplicationFirstRun()) {
         return;
     }
     if (file_exists(AJXP_CACHE_DIR . "/admin_counted")) {
         return;
     }
     $rootRole = AuthService::getRole("ROOT_ROLE", false);
     if ($rootRole === false) {
         $rootRole = new AJXP_Role("ROOT_ROLE");
         $rootRole->setLabel("Root Role");
         $rootRole->setAutoApplies(array("standard", "admin"));
         $dashId = "";
         foreach (ConfService::getRepositoriesList("all") as $repositoryId => $repoObject) {
             if ($repoObject->isTemplate) {
                 continue;
             }
             if ($repoObject->getAccessType() == "ajxp_user") {
                 $dashId = $repositoryId;
             }
             $gp = $repoObject->getGroupPath();
             if (empty($gp) || $gp == "/") {
                 if ($repoObject->getDefaultRight() != "") {
                     $rootRole->setAcl($repositoryId, $repoObject->getDefaultRight());
                 }
             }
         }
         if (!empty($dashId)) {
             $rootRole->setParameterValue("core.conf", "DEFAULT_START_REPOSITORY", $dashId);
         }
         $paramNodes = AJXP_PluginsService::searchAllManifests("//server_settings/param[@scope]", "node", false, false, true);
         if (is_array($paramNodes) && count($paramNodes)) {
             foreach ($paramNodes as $xmlNode) {
                 $default = $xmlNode->getAttribute("default");
                 if (empty($default)) {
                     continue;
                 }
                 $parentNode = $xmlNode->parentNode->parentNode;
                 $pluginId = $parentNode->getAttribute("id");
                 if (empty($pluginId)) {
                     $pluginId = $parentNode->nodeName . "." . $parentNode->getAttribute("name");
                 }
                 $rootRole->setParameterValue($pluginId, $xmlNode->getAttribute("name"), $default);
             }
         }
         AuthService::updateRole($rootRole);
     }
     $miniRole = AuthService::getRole("MINISITE", false);
     if ($miniRole === false) {
         $rootRole = new AJXP_Role("MINISITE");
         $rootRole->setLabel("Minisite Users");
         $actions = array("access.fs" => array("ajxp_link", "chmod", "purge"), "meta.watch" => array("toggle_watch"), "conf.serial" => array("get_bookmarks"), "conf.sql" => array("get_bookmarks"), "index.lucene" => array("index"), "action.share" => array("share"), "gui.ajax" => array("bookmark"), "auth.serial" => array("pass_change"), "auth.sql" => array("pass_change"));
         foreach ($actions as $pluginId => $acts) {
             foreach ($acts as $act) {
                 $rootRole->setActionState($pluginId, $act, AJXP_REPO_SCOPE_SHARED, false);
             }
         }
         AuthService::updateRole($rootRole);
     }
     $miniRole = AuthService::getRole("MINISITE_NODOWNLOAD", false);
     if ($miniRole === false) {
         $rootRole = new AJXP_Role("MINISITE_NODOWNLOAD");
         $rootRole->setLabel("Minisite Users - No Download");
         $actions = array("access.fs" => array("download", "download_chunk", "prepare_chunk_dl", "download_all"));
         foreach ($actions as $pluginId => $acts) {
             foreach ($acts as $act) {
                 $rootRole->setActionState($pluginId, $act, AJXP_REPO_SCOPE_SHARED, false);
             }
         }
         AuthService::updateRole($rootRole);
     }
     $miniRole = AuthService::getRole("GUEST", false);
     if ($miniRole === false) {
         $rootRole = new AJXP_Role("GUEST");
         $rootRole->setLabel("Guest user role");
         $actions = array("access.fs" => array("purge"), "meta.watch" => array("toggle_watch"), "index.lucene" => array("index"));
         $rootRole->setAutoApplies(array("guest"));
         foreach ($actions as $pluginId => $acts) {
             foreach ($acts as $act) {
                 $rootRole->setActionState($pluginId, $act, AJXP_REPO_SCOPE_ALL);
             }
         }
         AuthService::updateRole($rootRole);
     }
     $adminCount = AuthService::countAdminUsers();
     if ($adminCount == 0) {
         $authDriver = ConfService::getAuthDriverImpl();
         $adminPass = ADMIN_PASSWORD;
         if ($authDriver->getOption("TRANSMIT_CLEAR_PASS") !== true) {
             $adminPass = md5(ADMIN_PASSWORD);
         }
         AuthService::createUser("admin", $adminPass, true);
         if (ADMIN_PASSWORD == INITIAL_ADMIN_PASSWORD) {
//.........这里部分代码省略.........
开发者ID:biggtfish,项目名称:cms,代码行数:101,代码来源:class.AuthService.php

示例4: md5

     if (!is_writeable(USERS_DIR)) {
         $BEGIN_MESSAGE = "Warning, the users directory is not writeable!";
     }
 }
 if (AuthService::countAdminUsers() == 0) {
     $authDriver = ConfService::getAuthDriverImpl();
     $adminPass = ADMIN_PASSWORD;
     if ($authDriver->getOption("TRANSMIT_CLEAR_PASS") !== true) {
         $adminPass = md5(ADMIN_PASSWORD);
     }
     AuthService::createUser("admin", $adminPass, true);
     if (ADMIN_PASSWORD == INITIAL_ADMIN_PASSWORD) {
         $BEGIN_MESSAGE .= "Warning! User 'admin' was created with the initial common password 'admin'. \\nPlease log in as admin and change the password now!";
     }
 } else {
     if (AuthService::countAdminUsers() == -1) {
         // Here we may come from a previous version! Check the "admin" user and set its right as admin.
         $confStorage = ConfService::getConfStorageImpl();
         $adminUser = $confStorage->createUserObject("admin");
         $adminUser->setAdmin(true);
         $adminUser->save();
         $BEGIN_MESSAGE .= "You may come from a previous version. Now any user can have the administration rights, \\n your 'admin' user was set with the admin rights. Please check that this suits your security configuration.";
     }
 }
 $USERS_ENABLED = "true";
 if (AuthService::getLoggedUser() != null || AuthService::logUser(null, null) == 1) {
     $LOGGED_USER = "true";
     $loggedUser = AuthService::getLoggedUser();
     if (!$loggedUser->canRead(ConfService::getCurrentRootDirIndex()) && AuthService::getDefaultRootId() != ConfService::getCurrentRootDirIndex()) {
         ConfService::switchRootDir(AuthService::getDefaultRootId());
     }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:31,代码来源:index.php


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