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


PHP Factory::getScopeService方法代码示例

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


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

示例1: showAllServiceGroups

function showAllServiceGroups()
{
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    $scope = '%%';
    if (!empty($_GET['scope'])) {
        $scope = $_GET['scope'];
    }
    $scopes = \Factory::getScopeService()->getScopes();
    $sgKeyNames = "";
    if (isset($_GET['sgKeyNames'])) {
        $sgKeyNames = $_GET['sgKeyNames'];
    }
    $sgKeyValues = "";
    if (isset($_GET['selectedSGKeyValue'])) {
        $sgKeyValues = $_GET['selectedSGKeyValue'];
    }
    $sGroups = \Factory::getServiceGroupService()->getServiceGroups($scope, $sgKeyNames, $sgKeyValues);
    $exServ = \Factory::getExtensionsService();
    /* Doctrine will provide keynames that are the same even when selecting distinct becase the object
     * is distinct even though the name is not unique. To avoid showing the same name repeatdly in the filter
     * we will load all the keynames into an array before making it unique
     */
    $keynames = array();
    foreach ($exServ->getServiceGroupExtensionsKeyNames() as $extension) {
        $keynames[] = $extension->getKeyName();
    }
    $keynames = array_unique($keynames);
    $params['sGroups'] = $sGroups;
    $params['scopes'] = $scopes;
    $params['selectedScope'] = $scope;
    $params['selectedSGKeyName'] = $sgKeyNames;
    $params['selectedSGKeyValue'] = $sgKeyValues;
    $params['sgKeyName'] = $keynames;
    show_view("service_group/view_all.php", $params);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:35,代码来源:view_all.php

示例2: 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");
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:16,代码来源:add_ngi.php

示例3: show_scopes

function show_scopes()
{
    //Check the user has permission to see the page, will throw exception
    //if correct permissions are lacking
    checkUserIsAdmin();
    $scopes = \Factory::getScopeService()->getScopes();
    $params['Scopes'] = $scopes;
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    $params['portalIsReadOnly'] = portalIsReadOnlyAndUserIsNotAdmin($user);
    show_view('admin/scopes.php', $params, 'Scopes');
    die;
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:13,代码来源:scopes.php

示例4: view_ngis

function view_ngis()
{
    require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php';
    $scope = '%%';
    if (!empty($_GET['scope'])) {
        $scope = $_GET['scope'];
    }
    $scopes = \Factory::getScopeService()->getScopes();
    $ngis = \Factory::getNgiService()->getNGIs($scope);
    $params['ngis'] = $ngis;
    $params['scopes'] = $scopes;
    $params['selectedScope'] = $scope;
    show_view('ngi/view_ngis.php', $params, "NGIs");
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:14,代码来源:view_ngis.php

示例5: 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);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:21,代码来源:edit_ngi.php

示例6: 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;
    }
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:18,代码来源:add_service_group.php

示例7: submit

/**
 * Retrieves the new scopes data from a portal request and submit it to the
 * services layer's scope functions.
 * @return null
 */
function submit()
{
    require_once __DIR__ . '/../../../../htdocs/web_portal/components/Get_User_Principle.php';
    //Get the posted service type data
    $values = getScopeDataFromWeb();
    //get the user data for the add scope function (so it can check permissions)
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    try {
        //function will through error if user does not have the correct permissions
        $scope = \Factory::getScopeService()->addScope($values, $user);
        $params = array('Name' => $scope->getName(), 'ID' => $scope->getId());
        show_view("admin/added_scope.php", $params, "New scope succesffully created");
    } catch (Exception $e) {
        show_view('error.php', $e->getMessage());
        die;
    }
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:23,代码来源:add_scope.php

示例8: 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);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:46,代码来源:edit_site.php

示例9: 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);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:28,代码来源:edit_service.php

示例10: view_scope

function view_scope()
{
    //Check the user has permission to see the page, will throw exception
    //if correct permissions are lacking
    checkUserIsAdmin();
    if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
        throw new Exception("An id must be specified");
    }
    $dn = Get_User_Principle();
    $user = \Factory::getUserService()->getUserByPrinciple($dn);
    $serv = \Factory::getScopeService();
    $scope = $serv->getScope($_REQUEST['id']);
    $params['Name'] = $scope->getName();
    $params['Description'] = $scope->getDescription();
    $params['ID'] = $scope->getId();
    $params['NGIs'] = $serv->getNgisFromScope($scope);
    $params['Sites'] = $serv->getSitesFromScope($scope);
    $params['ServiceGroups'] = $serv->getServiceGroupsFromScope($scope);
    $params['Services'] = $serv->getServicesFromScope($scope);
    $params['portalIsReadOnly'] = portalIsReadOnlyAndUserIsNotAdmin($user);
    show_view("admin/scope.php", $params, $params['Name']);
    die;
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:23,代码来源:scope.php

示例11: drawSEs


//.........这里部分代码省略.........
    }
    if ($searchTerm != "") {
        $thisPage .= '&searchTerm=' . $searchTerm;
    }
    if ($production != "") {
        $thisPage .= '&production=' . $production;
    }
    if ($monitored != "") {
        $thisPage .= '&monitored=' . $monitored;
    }
    if ($scope != "") {
        $thisPage .= '&scope=' . $scope;
    }
    if ($ngi != "") {
        $thisPage .= '&ngi=' . $ngi;
    }
    if ($certStatus != "") {
        $thisPage .= '&certStatus=' . $certStatus;
    }
    if ($showClosed != "") {
        $thisPage .= '&showClosed=' . $showClosed;
    }
    if ($servKeyNames != "") {
        $thisPage .= '&servKeyNames=' . $servKeyNames;
    }
    if ($servKeyValues != "") {
        $thisPage .= '&servKeyValues=' . $servKeyValues;
    }
    if ($searchTerm != null || $searchTerm != "") {
        if (substr($searchTerm, 0, 1) != '%') {
            $searchTerm = '%' . $searchTerm;
        }
        if (substr($searchTerm, -1) != '%') {
            $searchTerm = $searchTerm . '%';
        }
    }
    $numResults = $seServ->getSesCount($searchTerm, $serviceType, $production, $monitored, $scope, $ngi, $certStatus, $showClosed, $servKeyNames, $servKeyValues, null, null, false);
    $firstLink = $thisPage . "&record=1";
    // Set the "previous" link
    if ($startRecord > RECORDS_PER_PAGE) {
        // Not showing the first page of results so enable the previous link
        $previousLink = $thisPage . "&record=" . ($startRecord - RECORDS_PER_PAGE);
    } else {
        // First page of results, disable previous button
        $previousLink = $thisPage . "&record=" . 0;
    }
    // Set the "Next" link
    // not the last page of results, normal next link
    if ($numResults - $startRecord > RECORDS_PER_PAGE) {
        $nextLink = $thisPage . "&record=" . ($startRecord + RECORDS_PER_PAGE);
    } else {
        // last page of results, disable next link
        $nextLink = $thisPage . '&record=' . ($numResults - RECORDS_PER_PAGE + 1);
    }
    $lastLink = $thisPage . "&record=" . ($numResults + 1 - RECORDS_PER_PAGE);
    // $startRecord + RECORDS_PER_PAGE "-1" because record 1 in the web portal == record 0 from DB
    $ses = $seServ->getSes($searchTerm, $serviceType, $production, $monitored, $scope, $ngi, $certStatus, $showClosed, $servKeyNames, $servKeyValues, $startRecord - 1, RECORDS_PER_PAGE, false);
    $endRecord = $startRecord + RECORDS_PER_PAGE - 1;
    /* Due to differences in counting, startRecord is still set to 1
     * even if there are zero results. If this is the case it's
     * zero here to display accurately in the portal.  */
    if (count($ses) == 0) {
        $startRecord = 0;
    }
    /* Doctrine will provide keynames that are the same even when selecting distinct becase the object
     * is distinct even though the name is not unique. To avoid showing the same name repeatdly in the filter
     * we will load all the keynames into an array before making it unique
     */
    $keynames = array();
    foreach ($exServ->getServiceExtensionsKeyNames() as $extension) {
        $keynames[] = $extension->getKeyName();
    }
    $keynames = array_unique($keynames);
    $serv = \Factory::getSiteService();
    $params['scopes'] = \Factory::getScopeService()->getScopes();
    $params['serviceTypes'] = $seServ->getServiceTypes();
    $params['servKeyNames'] = $keynames;
    $params['selectedServiceType'] = $serviceType;
    $params['searchTerm'] = $searchTerm;
    $params['services'] = $ses;
    $params['totalServices'] = $numResults;
    $params['startRecord'] = $startRecord;
    $params['endRecord'] = $endRecord;
    $params['firstLink'] = $firstLink;
    $params['previousLink'] = $previousLink;
    $params['nextLink'] = $nextLink;
    $params['lastLink'] = $lastLink;
    $params['ngis'] = \Factory::getNgiService()->getNGIs();
    $params['certStatuses'] = $serv->getCertStatuses();
    $params['showClosed'] = $showClosed;
    $params['selectedProduction'] = $production;
    $params['selectedMonitored'] = $monitored;
    $params['selectedScope'] = $scope;
    $params['selectedNgi'] = $ngi;
    $params['selectedClosed'] = $showClosed;
    $params['selectedCertStatus'] = $certStatus;
    $params['selectedServKeyNames'] = $servKeyNames;
    $params['selectedServKeyValue'] = $servKeyValues;
    show_view("service/view_all.php", $params, "Services");
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:101,代码来源:view_all.php

示例12: remove_scope

function remove_scope()
{
    //The following line will be needed if this controller is ever used for non administrators:
    //checkPortalIsNotReadOnlyOrUserIsAdmin($user);
    //Check user has permission
    checkUserIsAdmin();
    if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) {
        throw new Exception("An id must be specified");
    }
    //Get the scope from the id
    $serv = \Factory::getScopeService();
    $scope = $serv->getScope($_REQUEST['id']);
    //keep the name to display later
    $params['Name'] = $scope->getName();
    //check to see if there are NGIs, Sites, Service Groups, & services,
    // with this scope tag. If there are, prevent deletion of it.
    $ngisWithScope = $serv->getNgisFromScope($scope);
    $sitesWithScope = $serv->getSitesFromScope($scope);
    $sGroupWithScope = $serv->getServiceGroupsFromScope($scope);
    $serviceWithScope = $serv->getServicesFromScope($scope);
    $deletionAllowed = true;
    if (sizeof($ngisWithScope) > 0) {
        $deletionAllowed = false;
    }
    if (sizeof($sitesWithScope) > 0) {
        $deletionAllowed = false;
    }
    if (sizeof($sGroupWithScope) > 0) {
        $deletionAllowed = false;
    }
    if (sizeof($serviceWithScope) > 0) {
        $deletionAllowed = false;
    }
    //Allow the deletion of scopes that are in use
    $scopeInUseOveride = false;
    if (isset($_REQUEST['ScopeInUseOveride'])) {
        if ($_REQUEST['ScopeInUseOveride'] == 'true') {
            $scopeInUseOveride = true;
            $deletionAllowed = true;
        }
    }
    if ($deletionAllowed) {
        //Delete the scope. This fuction will check the user is allowed to
        //perform this action and throw an error if not.
        $dn = Get_User_Principle();
        $user = \Factory::getUserService()->getUserByPrinciple($dn);
        try {
            $serv->deleteScope($scope, $user, $scopeInUseOveride);
        } catch (\Exception $e) {
            show_view('error.php', $e->getMessage());
            die;
        }
        show_view("admin/deleted_scope.php", $params, $params['Name'] . 'deleted');
    } else {
        $params['ID'] = $scope->getId();
        $params['NGIs'] = $ngisWithScope;
        $params['Sites'] = $sitesWithScope;
        $params['ServiceGroups'] = $sGroupWithScope;
        $params['Services'] = $serviceWithScope;
        show_view('admin/delete_scope_denied.php', $params, "Scope still in use");
    }
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:62,代码来源:delete_scope.php

示例13: draw

/**
 *  Draw the add service form
 * @param \User $user current user 
 * @return null
 */
function draw($user)
{
    if (is_null($user)) {
        throw new Exception("Unregistered users can't add a service .");
    }
    /* Optional site parameter is set if a user clicked
     * "add SE to this site" on the view site page */
    $site = null;
    if (isset($_REQUEST['siteId'])) {
        $site = \Factory::getSiteService()->getSite($_REQUEST['siteId']);
        if ($site == null) {
            throw new Exception('Invalid site');
        }
        if (count(\Factory::getSiteService()->authorizeAction(\Action::SITE_ADD_SERVICE, $site, $user)) == 0) {
            throw new Exception('You do not have permission to add a service to this site');
        }
    }
    // Add sites which user has required action permission to array.
    $allUserSites = \Factory::getUserService()->getSitesFromRoles($user);
    $sites = array();
    foreach ($allUserSites as $s) {
        if (count(\Factory::getSiteService()->authorizeAction(\Action::SITE_ADD_SERVICE, $s, $user)) != 0) {
            $sites[] = $s;
        }
    }
    //For admin users, return all sites instead.
    if ($user->isAdmin()) {
        $sites = \Factory::getSiteService()->getSitesBy();
    }
    if (count($sites) == 0 and !$user->isAdmin()) {
        throw new Exception("You need at least one NGI or Site level role to add a new service.");
    }
    $serviceTypes = \Factory::getServiceService()->getServiceTypes();
    //If a site has been specified get scopes wit that sites scopes selected, otherwise get the default
    if (!is_null($serviceTypes) && $site instanceof \Site) {
        $scopes = \Factory::getScopeService()->getScopesSelectedArray($site->getScopes());
    } else {
        $scopes = \Factory::getScopeService()->getDefaultScopesSelectedArray();
    }
    //get the number of scopes that we require
    $numberScopesRequired = \Factory::getConfigService()->getMinimumScopesRequired('service');
    // remove the deprecated CE type (temp hack)
    foreach ($serviceTypes as $key => $st) {
        if ($st->getName() == "CE") {
            unset($serviceTypes[$key]);
        }
    }
    $params = array('sites' => $sites, 'serviceTypes' => $serviceTypes, 'scopes' => $scopes, 'site' => $site, 'numberOfScopesRequired' => $numberScopesRequired);
    //Check that there is at least one Site available before allowing a user to add a service.
    if ($params['sites'] == null) {
        show_view('error.php', "GocDB requires one or more Sites to be able to add a service.");
    }
    show_view("service/add_service.php", $params);
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:59,代码来源:add_service.php

示例14: draw

/**
 *  Draws a form to add a new site
 * @param \User $user current user 
 * @return null
 */
function draw(\User $user = null)
{
    if (is_null($user)) {
        throw new Exception("Unregistered users can't add a new site");
    }
    $siteService = \Factory::getSiteService();
    //try { $siteService->addAuthorization($user);
    //} catch(Exception $e) { show_view('error.php', $e->getMessage()); die(); }
    if ($user->isAdmin()) {
        // if user is admin, then get all NGIs
        $userNGIs = \Factory::getNgiService()->getNGIs();
    } else {
        // otherwise, get only the NGIs the non-admin user has roles over that support add_site
        $userNGIs = \Factory::getNgiService()->getNGIsBySupportedAction(Action::NGI_ADD_SITE, $user);
        if (count($userNGIs) == 0) {
            show_view('error.php', "You do not have permission to add a new site." . " To add a new site you require a managing role over an NGI");
            die;
        }
    }
    $countries = $siteService->getCountries();
    //$timezones = $siteService->getTimezones(); // Deprecated - don't use the lookup values in the GocDB
    $timezones = DateTimeZone::listIdentifiers();
    $prodStatuses = $siteService->getProdStatuses();
    //Remove SC and PPS infrastructures from drop down list. TODO: Delete this block once they no longer exist
    $SCInfrastructure = $siteService->getProdStatusByName('SC');
    $PPSInfrastructure = $siteService->getProdStatusByName('PPS');
    $hackprodStatuses = array();
    foreach ($prodStatuses as $ps) {
        if ($ps != $SCInfrastructure and $ps != $PPSInfrastructure) {
            $hackprodStatuses[] = $ps;
        }
    }
    $prodStatuses = $hackprodStatuses;
    //delete up to here once pps and sc infrastructures have been removed from database
    $certStatuses = $siteService->getCertStatuses();
    $scopes = \Factory::getScopeService()->getDefaultScopesSelectedArray();
    $numberOfScopesRequired = \Factory::getConfigService()->getMinimumScopesRequired('site');
    //$dDashNgis = \Factory::getUserService()->getDDashNgis($user);
    $params = array('ngis' => $userNGIs, 'countries' => $countries, 'timezones' => $timezones, 'prodStatuses' => $prodStatuses, 'certStatuses' => $certStatuses, 'scopes' => $scopes, 'numberOfScopesRequired' => $numberOfScopesRequired);
    //Check that there is at least one NGI available before allowing an add site.
    if ($params['ngis'] == null) {
        show_view('error.php', "GocDB requires one or more NGI's to be able to add a site.");
    }
    show_view("site/add_site.php", $params);
    die;
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:51,代码来源:add_site.php

示例15: draw

/**
 * Draws the edit service group form
 * @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");
    }
    // Get the service group
    $sg = $serv->getServiceGroup($_REQUEST['id']);
    //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;
    }
    // If the user is registered they're allowed to add a service group
    $configService = \Factory::getConfigService();
    $scopes = \Factory::getScopeService()->getScopesSelectedArray($sg->getScopes());
    $numberScopesRequired = $configService->getMinimumScopesRequired('service_group');
    $params = array('serviceGroup' => $sg, 'scopes' => $scopes, 'numberOfScopesRequired' => $numberScopesRequired);
    show_view("service_group/edit_service_group.php", $params, "Edit " . $sg->getName());
}
开发者ID:Tom-Byrne,项目名称:gocdb,代码行数:26,代码来源:edit_service_group.php


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