本文整理汇总了PHP中Factory::getConfigService方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getConfigService方法的具体用法?PHP Factory::getConfigService怎么用?PHP Factory::getConfigService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Factory
的用法示例。
在下文中一共展示了Factory::getConfigService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPortalIsNotReadOnly
/**
* Checks witht the config service if the portal is in read only mode and if
* it is throws an exception
* @throws \Exception
*/
function checkPortalIsNotReadOnly()
{
require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
if (\Factory::getConfigService()->IsPortalReadOnly()) {
throw new \Exception("The portal is currently in read only mode, changes can not be made.");
}
}
示例2: Get_Standard_Top_Section_HTML
function Get_Standard_Top_Section_HTML($title = null)
{
require_once __DIR__ . "/../../static_php/standard_header.php";
$HTML = "";
$HTML .= get_standard_header($title);
// container for the page
$HTML .= "<div class=\"page_container\">";
// menu bar
$HTML .= "<div class=\"left_box_menu\"\">";
$HTML .= Get_File_Contents(__DIR__ . "/../../static_html/goc5_logo.html");
//Insert a portal is in read only warning message, if it is
if (\Factory::getConfigService()->IsPortalReadOnly()) {
$HTML .= Get_File_Contents(__DIR__ . "/../../static_html/read_only_warning.html");
}
require_once "menu.php";
$HTML .= draw_menu("main_menu");
$HTML .= "</div>";
//$HTML .= "<h3 class=\"spacer\">Test</h3>";
$HTML .= Get_Search_Box_HTML();
$HTML .= Get_User_Info_Box_HTML();
$HTML .= Get_bottom_logos_Box_HTML();
// right side of the page
$HTML .= "<div class=\"right_box\">";
// logout button (if set - does not always need to be rendered)
if (!empty(\Factory::$properties['LOGOUTURL'])) {
$HTML .= "<div style='text-align: right;'>";
//$HTML .= '<a href="'.htmlspecialchars(\Factory::$properties['LOGOUTURL']).'"><b><font colour="red">Logout</font></b></a>';
$HTML .= '<a href="' . htmlspecialchars(\Factory::$properties['LOGOUTURL']) . '"><b><font class="btn btn-danger btn-xs">Logout</font></b></a>';
$HTML .= "</div>";
}
return $HTML;
}
示例3: draw
/**
* Draws the add NGI form
* @return null
*/
function draw()
{
require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
//Check the user has permission to see the page, will throw exception
//if correct permissions are lacking
checkUserIsAdmin();
//Get the list of scopes to chose from and the minimum number that need to be selected
$params['Scopes'] = \Factory::getScopeService()->getDefaultScopesSelectedArray();
$params['NumberOfScopesRequired'] = \Factory::getConfigService()->getMinimumScopesRequired('ngi');
//show the add NGI view
show_view("admin/add_ngi.php", $params, "Add NGI");
}
示例4: view_user
function view_user()
{
require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
require_once __DIR__ . '/../../components/Get_User_Principle.php';
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
throw new Exception("An id must be specified");
}
$userId = $_GET['id'];
$user = \Factory::getUserService()->getUser($userId);
if ($user === null) {
throw new Exception("No user with that ID");
}
$params['user'] = $user;
// get the targetUser's roles
$roles = \Factory::getRoleService()->getUserRoles($user, \RoleStatus::GRANTED);
//$user->getRoles();
$callingUser = \Factory::getUserService()->getUserByPrinciple(Get_User_Principle());
// can the calling user revoke the targetUser's roles?
if ($user != $callingUser) {
foreach ($roles as $r) {
//$ownedEntityDetail = $r->getOwnedEntity()->getName(). ' ('. $r->getOwnedEntity()->getType().')';
$authorisingRoleNames = \Factory::getRoleService()->authorizeAction(\Action::REVOKE_ROLE, $r->getOwnedEntity(), $callingUser);
if (count($authorisingRoleNames) >= 1) {
$allAuthorisingRoleNames = '';
foreach ($authorisingRoleNames as $arName) {
$allAuthorisingRoleNames .= $arName . ', ';
}
$allAuthorisingRoleNames = substr($allAuthorisingRoleNames, 0, strlen($allAuthorisingRoleNames) - 2);
$r->setDecoratorObject('[' . $allAuthorisingRoleNames . '] ');
}
}
} else {
// current user is viewing their own roles, so they can revoke their own roles
foreach ($roles as $r) {
$r->setDecoratorObject('[Self revoke own role]');
}
}
// Check to see if the current calling user has permission to edit the target user
try {
\Factory::getUserService()->editUserAuthorization($user, $callingUser);
$params['ShowEdit'] = true;
} catch (Exception $e) {
$params['ShowEdit'] = false;
}
/* @var $authToken \org\gocdb\security\authentication\IAuthentication */
$authToken = Get_User_AuthToken();
$params['authAttributes'] = $authToken->getDetails();
$params['roles'] = $roles;
$params['portalIsReadOnly'] = \Factory::getConfigService()->IsPortalReadOnly();
$title = $user->getFullName();
show_view("user/view_user.php", $params, $title);
}
示例5: process
function process()
{
header('Content-Type: application/xml');
//Type is GET request for XML info
$this->parseGET();
$xml = $this->getXml();
// returns the portal URL as defined in conf file
$portal_url = \Factory::getConfigService()->GetPortalURL();
//$portal_url = "https://URL/";
$xml = str_replace("#GOCDB_BASE_PORTAL_URL#", $portal_url, $xml);
echo $xml;
//echo('<test>val</test>');
}
示例6: startPage
function startPage()
{
require_once __DIR__ . '/../../../lib/Gocdb_Services/Factory.php';
require_once __DIR__ . '/../components/Get_User_Principle.php';
$dn = Get_User_Principle();
$user = \Factory::getUserService()->getUserByPrinciple($dn);
$roles = \Factory::getRoleService()->getPendingRolesUserCanApprove($user);
$configServ = \Factory::getConfigService();
$showMap = $configServ->getShowMapOnStartPage();
$apiKey = $configServ->getGoogleAPIKey();
$params = array('roles' => $roles, 'googleAPIKey' => $apiKey, 'showMap' => $showMap);
$title = "GOCDB";
show_view('start_page.php', $params, $title, null);
}
示例7: add_new_se_to_service_group
/**
* Controller for a new_service request
* @global array $_POST only set if the browser has POSTed data
* @return null
*/
function add_new_se_to_service_group()
{
require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
// Check to see whether to show the link to "add a new SE to this virtual site"
if (!Factory::getConfigService()->IsOptionalFeatureSet("siteless_services")) {
throw new Exception("This feature isn't enabled on this GOCDB " . "instance. Configuration keyword: siteless_services");
}
if ($_POST) {
// If we receive a POST request it's to add a new SE
submit_form();
} else {
// If there is no post data, draw the New SE form
draw_form();
}
}
示例8: draw
/**
* Draws the edit ngi form using the object ID passed in $_REQUEST
* @param \User $user current user
* @return null
*/
function draw(\User $user = null)
{
if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
throw new Exception("An id must be specified");
}
$serv = \Factory::getNgiService();
$ngi = $serv->getNgi($_REQUEST['id']);
// Old way: //$serv->edit Authorization($ngi, $user);
if (count($serv->authorizeAction(Action::EDIT_OBJECT, $ngi, $user)) == 0) {
throw new Exception('You do not have permission to edit this NGI');
}
$params = array('ngi' => $ngi);
$params['scopes'] = \Factory::getScopeService()->getScopesSelectedArray($ngi->getScopes());
$params['numberOfScopesRequired'] = \Factory::getConfigService()->getMinimumScopesRequired('ngi');
show_view('ngi/edit_ngi.php', $params);
}
示例9: portalIsReadOnlyAndUserIsNotAdmin
/**
* Checks config service and returns true if the portal is in read only mode (and
* the user is not a GOCDB admin.) Used to hide features of the portal used for
* editing entities when in read only mode.
*
* @param \user $user
* current user
* @return boolean
*/
function portalIsReadOnlyAndUserIsNotAdmin(\user $user = null)
{
require_once __DIR__ . '/../../../lib/Gocdb_Services/Factory.php';
// this block is required to deal with unregistered users (where $user is null)
$userIsAdmin = false;
if (!is_null($user)) {
if ($user->isAdmin()) {
// sub query required becauser ->isAdmin can't be called on null
$userIsAdmin = true;
}
}
if (\Factory::getConfigService()->IsPortalReadOnly() and !$userIsAdmin) {
return true;
} else {
return false;
}
}
示例10: draw
function draw($user)
{
try {
//\Factory::getServiceGroupService()->addAuthorization($user);
if (is_null($user)) {
throw new \Exception("Unregistered users can't create service groups.");
}
// If the user is registered they're allowed to add a service group
$configService = \Factory::getConfigService();
$scopes = \Factory::getScopeService()->getDefaultScopesSelectedArray();
$numberScopesRequired = $configService->getMinimumScopesRequired('service_group');
$params = array('scopes' => $scopes, 'numberOfScopesRequired' => $numberScopesRequired);
show_view("service_group/add_service_group.php", $params);
} catch (Exception $e) {
show_view("error.php", $e->getMessage());
die;
}
}
示例11: add_menu_item
function add_menu_item($menu_item)
{
//Get user in order to correctly display GOCDB admin menu Items
include_once __DIR__ . '/../Get_User_Principle.php';
$dn = Get_User_Principle();
$userserv = \Factory::getUserService();
$user = $userserv->getUserByPrinciple($dn);
if ($user == null) {
$userisadmin = false;
} else {
$userisadmin = $user->isAdmin();
}
//Find out if the portal is currently read only from local_info.xml
$portalIsReadOnly = \Factory::getConfigService()->IsPortalReadOnly();
foreach ($menu_item->children() as $key => $value) {
$html = "";
switch ($key) {
case "show_on_instance":
$show = strtolower($value);
break;
case "name":
$name = $value;
break;
case "link":
$link = $value;
break;
case "spacer":
// John C: modified this so that we could use show_on_instance for spacers
foreach ($menu_item as $child_name => $child_value) {
if ($child_name == "show_on_instance") {
// If the spacer has a show_on_instance type that we want to show, then show it
if ($child_value == "all" or $child_value == "write_enabled" and (!$portalIsReadOnly or $userisadmin) or $child_value == "admin" and $userisadmin) {
return "</ul><h4 class='menu_title'>{$value}</h4><ul class=\"Smaller_Left_Padding Smaller_Top_Margin\">";
}
}
}
return;
}
}
if ($show == "all" or $show == "write_enabled" and (!$portalIsReadOnly or $userisadmin) or $show == "admin" and $userisadmin) {
$html .= "<li class=\"Menu_Item\">" . "<a href=\"" . $link . "\"><span class=\"menu_link\">" . $name . "</span></a></li>";
}
return $html;
}
示例12: draw
/**
* Draws the edit site form using the object ID passed in $_REQUEST
* @param \User $user current user
* @throws Exception
* @return null
*/
function draw(\User $user = null)
{
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
throw new Exception("An id must be specified");
}
$serv = \Factory::getSiteService();
$site = $serv->getSite($_GET['id']);
/*Old way: try { \Factory::getSiteService()->edit Authorization($site, $user);
} catch(Exception $e) { show_view('error.php', $e->getMessage()); die(); }*/
if (count($serv->authorizeAction(Action::EDIT_OBJECT, $site, $user)) == 0) {
throw new Exception('You do not have permission to edit this Site');
}
//else { print_r($serv->authorizeAction(Action::EDIT_OBJECT, $site, $user));}
$countries = $serv->getCountries();
//$timezones = $serv->getTimezones(); // Deprecated - don't use the lookup values in the GocDB
$timezones = DateTimeZone::listIdentifiers();
// get the standard values
$prodStatuses = $serv->getProdStatuses();
//Remove SC and PPS infrastructures from drop down list (unless site has one of them). TODO: Delete this block once they no longer exist
$SCInfrastructure = $serv->getProdStatusByName('SC');
$PPSInfrastructure = $serv->getProdStatusByName('PPS');
$hackprodStatuses = array();
foreach ($prodStatuses as $ps) {
if ($ps != $SCInfrastructure and $ps != $PPSInfrastructure or $ps == $site->getInfrastructure()) {
$hackprodStatuses[] = $ps;
}
}
$prodStatuses = $hackprodStatuses;
//delete up to here once pps and sc infrastructures have been removed from database
$scopes = \Factory::getScopeService()->getScopesSelectedArray($site->getScopes());
//get parent scope ids to generate warning message in view
$parentScopeIds = array();
foreach ($site->getNgi()->getScopes() as $scope) {
$parentScopeIds[] = $scope->getId();
}
$configServ = \Factory::getConfigService();
$numberScopesRequired = $configServ->getMinimumScopesRequired('site');
$params = array("site" => $site, "timezones" => $timezones, "countries" => $countries, "prodStatuses" => $prodStatuses, "scopes" => $scopes, "numberOfScopesRequired" => $numberScopesRequired, "parentScopeIds" => $parentScopeIds);
show_view('site/edit_site.php', $params);
}
示例13: draw
/**
* Draw the edit site form.
* @param \User $user
* @throws \Exception
*/
function draw(\User $user = null)
{
if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
throw new Exception("An id must be specified");
}
$id = $_REQUEST['id'];
$serv = \Factory::getServiceService();
$se = $serv->getService($id);
if (count(Factory::getServiceService()->authorizeAction(\Action::EDIT_OBJECT, $se, $user)) == 0) {
throw new \Exception("You do not have permission over {$se}.");
}
$configservice = \Factory::getConfigService();
//get parent scope ids to generate warning message in view
$params["parentScopeIds"] = array();
foreach ($se->getParentSite()->getScopes() as $scope) {
$params["parentScopeIds"][] = $scope->getId();
}
$params['se'] = $se;
$params['serviceTypes'] = $serv->getServiceTypes();
$params['scopes'] = \Factory::getScopeService()->getScopesSelectedArray($se->getScopes());
$params['numberOfScopesRequired'] = $configservice->getMinimumScopesRequired('service');
show_view('service/edit_service.php', $params);
}
示例14: draw
/**
* Draws a form for the user to add services to a service group
* @global array $_REQUEST only set if the browser has sent parameters
* @param \User $user current user
* @return null
*/
function draw(\User $user = null)
{
$serv = \Factory::getServiceGroupService();
if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
throw new Exception("An id must be specified");
}
// The service group to add SEs to
$sg = $serv->getServiceGroup($_REQUEST['id']);
// Check the user is authorized to perform this operation
//try { $serv->editAuthorization($sg, $user); } catch(Exception $e) {
// show_view('error.php', $e->getMessage()); die(); }
if (count($serv->authorizeAction(\Action::EDIT_OBJECT, $sg, $user)) == 0) {
show_view('error.php', 'You do not have permission to edit this ServiceGroup');
die;
}
// Check to see whether to show the link to "add a new SE to this virtual site"
if (\Factory::getConfigService()->IsOptionalFeatureSet("siteless_services")) {
$siteLessServices = true;
} else {
$siteLessServices = false;
}
$params = array('sg' => $sg, 'siteLessServices' => $siteLessServices);
show_view('service_group/add_ses.php', $params);
}
示例15: submitRoleRequest
/**
* Processes a role request submission
* @param type $roleName
* @param type $entityId
* @param \User $user current user
* @throws Exception
*/
function submitRoleRequest($roleName, $entityId, \User $user = null)
{
// validate the enityId is numeric
if (!is_numeric($entityId)) {
throw new Exception('Invalid entityId');
}
// Get the owned entity instance
$entity = \Factory::getOwnedEntityService()->getOwnedEntityById($entityId);
// Create a new Role linking user, entity and roletype. The addRole
// perfoms role validation and throws exceptios accordingly.
$newRole = \Factory::getRoleService()->addRole($roleName, $user, $entity);
if (\Factory::getConfigService()->getSendEmails()) {
\Factory::getNotificationService()->roleRequest($entity);
}
show_view('political_role/new_request.php');
}