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


PHP PermissionsManager类代码示例

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


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

示例1: testDuplicateOtherProjectShouldNotHaveUgroupMapping

 function testDuplicateOtherProjectShouldNotHaveUgroupMapping()
 {
     $source = 123;
     $target = 234;
     $permission_types = array('STUFF_READ');
     $dao = new MockPermissionsDao();
     $dao->expectOnce('duplicatePermissions', array($source, $target, $permission_types, PermissionsDao::DUPLICATE_OTHER_PROJECT, false));
     $permissionsManager = new PermissionsManager($dao);
     $permissionsManager->duplicateWithoutStatic($source, $target, $permission_types);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:10,代码来源:PermissionsManagerTest.php

示例2: page_permissions

 public function page_permissions()
 {
     if (isset($_POST['save-permissions'])) {
         PermissionObject::removeAllPermissions();
         if (isset($_POST['permission'])) {
             foreach ($_POST['permission'] as $perm => $groups) {
                 foreach ($groups as $grp => $d) {
                     PermissionObject::addPermission($grp, $perm);
                 }
             }
         }
         Notification::statusNotify(t("configuration enregistrée"), Notification::STATUS_SUCCESS);
     }
     $defined_permissions = PermissionObject::loadAllPermissions();
     $df = array();
     foreach ($defined_permissions as $p) {
         if (!isset($df[$p->pid])) {
             $df[$p->pid] = array();
         }
         $df[$p->pid][$p->gid] = 1;
     }
     $p = new PermissionsManager();
     $permissions = $p->scanForPermission();
     $groups = GroupObject::loadAll();
     $table = array();
     $hcol = array("");
     $hrow = array();
     foreach ($permissions as $u => $t) {
         $hrow[] = $t;
         $row = array();
         foreach ($groups as $gd => $g) {
             if ($u == 0) {
                 $hcol[] = $g->label;
             }
             $pm = new PermissionObject();
             $pm->loadByName($t);
             $tlabel = "permission[" . $g->gid . "][" . $pm->pid . "]";
             if (isset($df[$pm->pid][$g->gid])) {
                 $row[] = "<input type='checkbox' name='{$tlabel}' id='{$tlabel}' checked='checked'/>";
             } else {
                 $row[] = "<input type='checkbox'  name='{$tlabel}' id='{$tlabel}' />";
             }
         }
         $table[] = $row;
     }
     $theme = new Theme();
     $theme->set_title(t("Permissions déclarées"));
     $table = Themed::tabling($table, $hcol, $hrow);
     $theme->add_to_body("<form method='POST' action=''>{$table} <input type='submit' name='save-permissions' value='" . t("Enregistrer") . "'/></form>");
     $theme->process_theme(Theme::STRUCT_ADMIN);
 }
开发者ID:decima,项目名称:M2-platine,代码行数:51,代码来源:module.php

示例3: getPermissionsManager

 private function getPermissionsManager()
 {
     if (empty($this->permission_manager)) {
         $this->permission_manager = PermissionsManager::instance();
     }
     return $this->permission_manager;
 }
开发者ID:blestab,项目名称:tuleap,代码行数:7,代码来源:FRSXMLImporter.class.php

示例4: tearDown

 public function tearDown()
 {
     parent::tearDown();
     $this->item_id++;
     PermissionsManager::clearInstance();
     ProjectManager::clearInstance();
     Docman_ItemFactory::clearInstance($this->project->getID());
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:PermissionsItemManagerTest.php

示例5: getUgroupIdsPermissions

 private function getUgroupIdsPermissions(Docman_Item $item, UGroupLiteralizer $literalizer, Project $project)
 {
     $ugroups_ids = $literalizer->getUgroupIds($project, $item->getId(), self::PERMISSIONS_TYPE);
     if (empty($ugroups_ids)) {
         $ugroups_ids = PermissionsManager::instance()->getAuthorizedUgroupIds($project->getID(), 'PLUGIN_DOCMAN_ADMIN');
     }
     $parent_item = $this->getParentItem($item, $project);
     if ($parent_item) {
         $parent_ugroups_ids = $this->getUgroupIdsPermissions($parent_item, $literalizer, $project);
         $ugroups_ids = $this->mergeUgroupIds($parent_ugroups_ids, $ugroups_ids);
     }
     return array_values($ugroups_ids);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:13,代码来源:Docman_PermissionsItemManager.class.php

示例6: tearDown

 public function tearDown()
 {
     $GLOBALS['Language'] = null;
     PermissionsManager::clearInstance();
     UserManager::clearInstance();
     if (isset($this->old_ftp_incoming_dir)) {
         $GLOBALS['ftp_incoming_dir'] = $this->old_ftp_incoming_dir;
     } else {
         unset($GLOBALS['ftp_incoming_dir']);
     }
     if (isset($this->old_ftp_frs_dir_prefix)) {
         $GLOBALS['ftp_frs_dir_prefix'] = $this->old_ftp_frs_dir_prefix;
     } else {
         unset($GLOBALS['ftp_frs_dir_prefix']);
     }
 }
开发者ID:blestab,项目名称:tuleap,代码行数:16,代码来源:FRSXMLImporterTest.php

示例7: saveObject

 /**
  * Saves a Tracker object into the DataBase
  *
  * @param Tracker $tracker object to save
  * @return int id of the newly created tracker
  */
 public function saveObject($tracker)
 {
     // create tracker
     $tracker_id = $this->getDao()->create($tracker->group_id, $tracker->name, $tracker->description, $tracker->item_name, $tracker->allow_copy, $tracker->submit_instructions, $tracker->browse_instructions, '', '', $tracker->instantiate_for_new_projects, $tracker->stop_notification);
     if ($tracker_id) {
         $trackerDB = $this->getTrackerById($tracker_id);
         //create cannedResponses
         $response_factory = $tracker->getCannedResponseFactory();
         foreach ($tracker->cannedResponses as $response) {
             $response_factory->saveObject($tracker_id, $response);
         }
         //create formElements
         foreach ($tracker->formElements as $formElement) {
             // these fields have no parent
             Tracker_FormElementFactory::instance()->saveObject($trackerDB, $formElement, 0);
         }
         //create report
         foreach ($tracker->reports as $report) {
             Tracker_ReportFactory::instance()->saveObject($tracker_id, $report);
         }
         //create semantics
         if (isset($tracker->semantics)) {
             foreach ($tracker->semantics as $semantic) {
                 Tracker_SemanticFactory::instance()->saveObject($semantic, $trackerDB);
             }
         }
         //create workflow
         if (isset($tracker->workflow)) {
             WorkflowFactory::instance()->saveObject($tracker->workflow, $trackerDB);
         }
         //tracker permissions
         if ($tracker->permissionsAreCached()) {
             $pm = PermissionsManager::instance();
             foreach ($tracker->getPermissions() as $ugroup => $permissions) {
                 foreach ($permissions as $permission) {
                     $pm->addPermission($permission, $tracker_id, $ugroup);
                 }
             }
         } else {
             $this->saveTrackerDefaultPermission($tracker_id);
         }
         $this->postCreateActions($trackerDB);
     }
     return $tracker_id;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:51,代码来源:TrackerFactory.class.php

示例8: header

<?php

include_once '../../config/symbini.php';
include_once $serverRoot . '/classes/PermissionsManager.php';
header("Content-Type: text/html; charset=" . $charset);
$action = array_key_exists("action", $_REQUEST) ? $_REQUEST["action"] : "";
$collId = array_key_exists("collid", $_REQUEST) ? $_REQUEST["collid"] : 0;
$permManager = new PermissionsManager();
$isEditor = 0;
if ($SYMB_UID) {
    if ($IS_ADMIN || array_key_exists("CollAdmin", $USER_RIGHTS) && in_array($collId, $USER_RIGHTS["CollAdmin"])) {
        $isEditor = 1;
    }
}
if ($isEditor) {
    if (array_key_exists('deladmin', $_GET)) {
        $permManager->deletePermission($_GET['deladmin'], 'CollAdmin', $collId);
    } elseif (array_key_exists('deleditor', $_GET)) {
        $permManager->deletePermission($_GET['deleditor'], 'CollEditor', $collId);
    } elseif (array_key_exists('delrare', $_GET)) {
        $permManager->deletePermission($_GET['delrare'], 'RareSppReader', $collId);
    } elseif (array_key_exists('delidenteditor', $_GET)) {
        $permManager->deletePermission($_GET['delidenteditor'], 'CollTaxon', $collId, $_GET['utid']);
        if (is_numeric($_GET['utid'])) {
            $permManager->deletePermission($_GET['delidenteditor'], 'CollTaxon', $collId, 'all');
        }
    } elseif ($action == 'Add Permissions for User') {
        $rightType = $_POST['righttype'];
        if ($rightType == 'admin') {
            $permManager->addPermission($_POST['uid'], "CollAdmin", $collId);
        } elseif ($rightType == 'editor') {
开发者ID:urban011,项目名称:ut-prc-symbiota,代码行数:31,代码来源:collpermissions.php

示例9: header

<?php

include_once '../config/symbini.php';
include_once $serverRoot . '/classes/PermissionsManager.php';
include_once $serverRoot . '/classes/ProfileManager.php';
header("Content-Type: text/html; charset=" . $charset);
$loginAs = array_key_exists("loginas", $_REQUEST) ? trim($_REQUEST["loginas"]) : "";
$searchTerm = array_key_exists("searchterm", $_REQUEST) ? trim($_REQUEST["searchterm"]) : "";
$userId = array_key_exists("userid", $_REQUEST) ? $_REQUEST["userid"] : "";
$delRole = array_key_exists("delrole", $_REQUEST) ? $_REQUEST["delrole"] : "";
$tablePk = array_key_exists("tablepk", $_REQUEST) ? $_REQUEST["tablepk"] : "";
$userManager = new PermissionsManager();
if ($isAdmin) {
    if ($loginAs) {
        $pHandler = new ProfileManager();
        $pHandler->setUserName($loginAs);
        $pHandler->authenticate();
        header("Location: ../index.php");
    } elseif ($delRole) {
        $userManager->deletePermission($userId, $delRole, $tablePk);
    } elseif (array_key_exists("apsubmit", $_POST)) {
        foreach ($_POST["p"] as $pname) {
            $role = $pname;
            $tablePk = '';
            if (strpos($pname, '-')) {
                $tok = explode('-', $pname);
                $role = $tok[0];
                $tablePk = $tok[1];
            }
            $userManager->addPermission($userId, $role, $tablePk);
        }
开发者ID:jphilip124,项目名称:Symbiota,代码行数:31,代码来源:usermanagement.php

示例10: getPermissionsManager

 private function getPermissionsManager()
 {
     return new Tuleap\ProFTPd\Admin\PermissionsManager(PermissionsManager::instance(), new UGroupManager());
 }
开发者ID:uniteddiversity,项目名称:tuleap,代码行数:4,代码来源:proftpdPlugin.class.php

示例11: frs_display_release_form

function frs_display_release_form($is_update, &$release, $group_id, $title, $url)
{
    global $frspf, $frsrf, $frsff;
    $hp =& Codendi_HTMLPurifier::instance();
    if (is_array($release)) {
        if (isset($release['date'])) {
            $release_date = $release['date'];
        }
        $release = new FRSRelease($release);
    }
    if ($is_update) {
        $files = $release->getFiles();
        if (count($files) > 0) {
            for ($i = 0; $i < count($files); $i++) {
                if (!$frsff->compareMd5Checksums($files[$i]->getComputedMd5(), $files[$i]->getReferenceMd5())) {
                    $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('file_admin_editreleases', 'md5_fail', array(basename($files[$i]->getFileName()), $files[$i]->getComputedMd5())));
                }
            }
        }
    }
    file_utils_admin_header(array('title' => $GLOBALS['Language']->getText('file_admin_editreleases', 'release_new_file_version'), 'help' => 'frs.html#delivery-manager-administration'));
    echo '<H3>' . $hp->purify($title, CODENDI_PURIFIER_CONVERT_HTML) . '</H3>';
    $sql = "SELECT * FROM frs_processor WHERE (group_id = 100 OR group_id = " . db_ei($group_id) . ") ORDER BY rank";
    $result = db_query($sql);
    $processor_id = util_result_column_to_array($result, 0);
    $processor_name = util_result_column_to_array($result, 1);
    foreach ($processor_name as $key => $value) {
        $processor_name[$key] = $hp->purify($value, CODENDI_PURIFIER_JS_QUOTE);
    }
    $sql = "SELECT * FROM frs_filetype ORDER BY type_id";
    $result1 = db_query($sql);
    $type_id = util_result_column_to_array($result1, 0);
    $type_name = util_result_column_to_array($result1, 1);
    $url_news = get_server_url() . "/file/showfiles.php?group_id=" . $group_id;
    echo '<script type="text/javascript">';
    echo "var processor_id = ['" . implode("', '", $processor_id) . "'];";
    echo "var processor_name = ['" . implode("', '", $processor_name) . "'];";
    echo "var type_id = ['" . implode("', '", $type_id) . "'];";
    echo "var type_name = ['" . implode("', '", $type_name) . "'];";
    echo "var group_id = " . $group_id . ";";
    echo "var relname = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'relname') . "';";
    echo "var choose = '" . $GLOBALS['Language']->getText('file_file_utils', 'must_choose_one') . "';";
    echo "var browse = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'browse') . "';";
    echo "var local_file = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'local_file') . "';";
    echo "var scp_ftp_files = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'scp_ftp_files') . "';";
    echo "var upload_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'upload') . "';";
    echo "var add_file_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_file') . "';";
    echo "var add_change_log_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'add_change_log') . "';";
    echo "var view_change_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'view_change') . "';";
    echo "var refresh_files_list = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'refresh_file_list') . "';";
    echo "var release_mode = '" . ($is_update ? 'edition' : 'creation') . "';";
    if ($is_update) {
        $pm = PermissionsManager::instance();
        $dar = $pm->getAuthorizedUgroups($release->getReleaseID(), FRSRelease::PERM_READ);
        $ugroups_name = array();
        foreach ($dar as $row) {
            $ugroups_name[] = util_translate_name_ugroup($row['name']);
        }
        echo "var ugroups_name = '" . implode(", ", $ugroups_name) . "';";
        echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'release_perm') . "';";
    } else {
        echo "var default_permissions_text = '" . $GLOBALS['Language']->getText('file_admin_editreleases', 'default_permissions') . "';";
    }
    echo '</script>';
    //set variables for news template
    $relname = $GLOBALS['Language']->getText('file_admin_editreleases', 'relname');
    if (!$is_update) {
        echo '<p>' . $GLOBALS['Language']->getText('file_admin_editreleases', 'contain_multiple_files') . '</p>';
    }
    ?>
    
    <FORM id="frs_form" NAME="frsRelease" ENCTYPE="multipart/form-data" METHOD="POST" ACTION="<?php 
    echo $url;
    ?>
" CLASS="form-inline">
        <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<? echo $GLOBALS['sys_max_size_upload']; ?>">
        <input type="hidden" name="postReceived" value="" />
        <?php 
    if ($release->getReleaseId()) {
        echo '<input type="hidden" id="release_id" name="release[release_id]" value="' . $release->getReleaseId() . '" />';
    }
    ?>
        <TABLE BORDER="0" width="100%">
        <TR><TD><FIELDSET><LEGEND><?php 
    echo $GLOBALS['Language']->getText('file_admin_editreleases', 'fieldset_properties');
    ?>
</LEGEND>
        <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="2">
            <TR>
                <TD>
                    <B><?php 
    echo $GLOBALS['Language']->getText('file_admin_editpackages', 'p_name');
    ?>
:</B>
                </TD>
                <TD>
    <?php 
    $res =& $frspf->getFRSPackagesFromDb($group_id);
    $rows = count($res);
    if (!$res || $rows < 1) {
//.........这里部分代码省略.........
开发者ID:rinodung,项目名称:tuleap,代码行数:101,代码来源:file_utils.php

示例12: getPermissionsManager

 /**
  * Returns a PermissionsManager instance
  *
  * @return PermissionsManager
  */
 function getPermissionsManager()
 {
     $pm =& PermissionsManager::instance();
     return $pm;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:10,代码来源:WebDAVUtils.class.php

示例13: canBeReadByAnonymous

 private function canBeReadByAnonymous(GitRepository $repository)
 {
     $ugroup_ids = $this->permissions_manager->getAuthorizedUgroupIds($repository->getId(), Git::PERM_READ);
     foreach ($ugroup_ids as $ugroup_id) {
         if ($ugroup_id == ProjectUGroup::ANONYMOUS) {
             return true;
         }
     }
     return false;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:10,代码来源:CommandFactory.class.php

示例14: getUgroups

 /**
  * Return the list of UGroupIds according to Git permissions that can be managed by Gerrit
  *
  * @param Integer $repository_id
  * @param String  $permission_type
  *
  * @return array
  */
 public function getUgroups($repository_id, $permission_type)
 {
     if ($permission_type == Git::SPECIAL_PERM_ADMIN) {
         return array(ProjectUGroup::PROJECT_ADMIN);
     }
     $ugroup_ids = $this->permissions_manager->getAuthorizedUgroups($repository_id, $permission_type, false);
     $result = array();
     foreach ($ugroup_ids as $row) {
         $result[] = $row['ugroup_id'];
     }
     return $result;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:20,代码来源:UserFinder.class.php

示例15: updateAccess

 public function updateAccess($new_value, $old_value)
 {
     if ($new_value === $old_value) {
         return;
     }
     $property_name = ForgeAccess::CONFIG;
     $this->config_dao->save($property_name, $new_value);
     $this->event_manager->processEvent(Event::SITE_ACCESS_CHANGE, array('new_value' => $new_value, 'old_value' => $old_value));
     if ($old_value === ForgeAccess::RESTRICTED || $new_value === ForgeAccess::RESTRICTED) {
         $this->project_manager->disableAllowRestrictedForAll();
         $this->permission_manager->disableRestrictedAccess();
     }
 }
开发者ID:pdaniel-frk,项目名称:tuleap,代码行数:13,代码来源:ForgePropertiesManager.class.php


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