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


PHP PhabricatorPolicyFilter类代码示例

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


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

示例1: execute

 public final function execute()
 {
     if (!$this->viewer) {
         throw new Exception("Call setViewer() before execute()!");
     }
     $results = array();
     $filter = new PhabricatorPolicyFilter();
     $filter->setViewer($this->viewer);
     $filter->setCapability(PhabricatorPolicyCapability::CAN_VIEW);
     $filter->raisePolicyExceptions($this->raisePolicyExceptions);
     do {
         $page = $this->loadPage();
         $visible = $filter->apply($page);
         foreach ($visible as $key => $result) {
             $results[$key] = $result;
             if ($this->getLimit() && count($results) >= $this->getLimit()) {
                 break 2;
             }
         }
         if (!$this->getLimit() || count($page) < $this->getLimit()) {
             break;
         }
         $this->nextPage($page);
     } while (true);
     return $results;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:26,代码来源:PhabricatorPolicyQuery.php

示例2: testFileVisibility

 public function testFileVisibility()
 {
     $engine = new PhabricatorTestStorageEngine();
     $data = Filesystem::readRandomCharacters(64);
     $author = $this->generateNewTestUser();
     $viewer = $this->generateNewTestUser();
     $users = array($author, $viewer);
     $params = array('name' => 'test.dat', 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, 'authorPHID' => $author->getPHID(), 'storageEngines' => array($engine));
     $file = PhabricatorFile::newFromFileData($data, $params);
     $filter = new PhabricatorPolicyFilter();
     // Test bare file policies.
     $this->assertEqual(array(true, false), $this->canViewFile($users, $file), pht('File Visibility'));
     // Create an object and test object policies.
     $object = ManiphestTask::initializeNewTask($author);
     $object->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy());
     $object->save();
     $this->assertTrue($filter->hasCapability($author, $object, PhabricatorPolicyCapability::CAN_VIEW), pht('Object Visible to Author'));
     $this->assertTrue($filter->hasCapability($viewer, $object, PhabricatorPolicyCapability::CAN_VIEW), pht('Object Visible to Others'));
     // Attach the file to the object and test that the association opens a
     // policy exception for the non-author viewer.
     $file->attachToObject($object->getPHID());
     // Test the attached file's visibility.
     $this->assertEqual(array(true, true), $this->canViewFile($users, $file), pht('Attached File Visibility'));
     // Create a "thumbnail" of the original file.
     $params = array('name' => 'test.thumb.dat', 'viewPolicy' => PhabricatorPolicies::POLICY_NOONE, 'storageEngines' => array($engine));
     $xform = PhabricatorFile::newFromFileData($data, $params);
     id(new PhabricatorTransformedFile())->setOriginalPHID($file->getPHID())->setTransform('test-thumb')->setTransformedPHID($xform->getPHID())->save();
     // Test the thumbnail's visibility.
     $this->assertEqual(array(true, true), $this->canViewFile($users, $xform), pht('Attached Thumbnail Visibility'));
     // Detach the object and make sure it affects the thumbnail.
     $file->detachFromObject($object->getPHID());
     // Test the detached thumbnail's visibility.
     $this->assertEqual(array(true, false), $this->canViewFile($users, $xform), pht('Detached Thumbnail Visibility'));
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:34,代码来源:PhabricatorFileTestCase.php

示例3: hasCapability

 public static function hasCapability(PhabricatorUser $user, PhabricatorPolicyInterface $object, $capability)
 {
     $filter = new PhabricatorPolicyFilter();
     $filter->setViewer($user);
     $filter->requireCapabilities(array($capability));
     $result = $filter->apply(array($object));
     return count($result) == 1;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:8,代码来源:PhabricatorPolicyFilter.php

示例4: renderPreface

 private function renderPreface()
 {
     $viewer = $this->getRequest()->getUser();
     $branch = $this->getBranch();
     $id = $branch->getID();
     $header = id(new PHUIHeaderView())->setHeader($branch->getDisplayName())->setUser($viewer)->setPolicyObject($branch);
     if ($branch->getIsActive()) {
         $header->setStatus('fa-check', 'bluegrey', pht('Active'));
     } else {
         $header->setStatus('fa-ban', 'dark', pht('Closed'));
     }
     $actions = id(new PhabricatorActionListView())->setUser($viewer)->setObject($branch)->setObjectURI($this->getRequest()->getRequestURI());
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $branch, PhabricatorPolicyCapability::CAN_EDIT);
     $edit_uri = $this->getApplicationURI("branch/edit/{$id}/");
     $close_uri = $this->getApplicationURI("branch/close/{$id}/");
     $reopen_uri = $this->getApplicationURI("branch/re-open/{$id}/");
     $history_uri = $this->getApplicationURI("branch/{$id}/history/");
     $actions->addAction(id(new PhabricatorActionView())->setName(pht('Edit Branch'))->setHref($edit_uri)->setIcon('fa-pencil')->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     if ($branch->getIsActive()) {
         $actions->addAction(id(new PhabricatorActionView())->setName(pht('Close Branch'))->setHref($close_uri)->setIcon('fa-times')->setDisabled(!$can_edit)->setWorkflow(true));
     } else {
         $actions->addAction(id(new PhabricatorActionView())->setName(pht('Reopen Branch'))->setHref($reopen_uri)->setIcon('fa-plus')->setUser($viewer)->setDisabled(!$can_edit)->setWorkflow(true));
     }
     $actions->addAction(id(new PhabricatorActionView())->setName(pht('View History'))->setHref($history_uri)->setIcon('fa-list'));
     $properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($branch)->setActionList($actions);
     $properties->addProperty(pht('Branch'), $branch->getName());
     return id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:28,代码来源:ReleephBranchViewController.php

示例5: buildActionView

 private function buildActionView(ManiphestTask $task)
 {
     $viewer = $this->getRequest()->getUser();
     $id = $task->getID();
     $phid = $task->getPHID();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $task, PhabricatorPolicyCapability::CAN_EDIT);
     $view = id(new PhabricatorActionListView())->setUser($viewer)->setObject($task);
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Task'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("/task/edit/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Merge Duplicates In'))->setHref("/search/attach/{$phid}/TASK/merge/")->setWorkflow(true)->setIcon('fa-compress')->setDisabled(!$can_edit)->setWorkflow(true));
     $edit_config = id(new ManiphestEditEngine())->setViewer($viewer)->loadDefaultEditConfiguration();
     $can_create = (bool) $edit_config;
     if ($can_create) {
         $form_key = $edit_config->getIdentifier();
         $edit_uri = id(new PhutilURI("/task/edit/form/{$form_key}/"))->setQueryParam('parent', $id)->setQueryParam('template', $id)->setQueryParam('status', ManiphestTaskStatus::getDefaultStatus());
         $edit_uri = $this->getApplicationURI($edit_uri);
     } else {
         // TODO: This will usually give us a somewhat-reasonable error page, but
         // could be a bit cleaner.
         $edit_uri = "/task/edit/{$id}/";
         $edit_uri = $this->getApplicationURI($edit_uri);
     }
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Create Subtask'))->setHref($edit_uri)->setIcon('fa-level-down')->setDisabled(!$can_create)->setWorkflow(!$can_create));
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Blocking Tasks'))->setHref("/search/attach/{$phid}/TASK/blocks/")->setWorkflow(true)->setIcon('fa-link')->setDisabled(!$can_edit)->setWorkflow(true));
     return $view;
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:25,代码来源:ManiphestTaskDetailController.php

示例6: buildActionView

 private function buildActionView(PhabricatorUser $viewer, PhabricatorPaste $paste, PhabricatorFile $file)
 {
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $paste, PhabricatorPolicyCapability::CAN_EDIT);
     $can_fork = $viewer->isLoggedIn();
     $fork_uri = $this->getApplicationURI('/create/?parent=' . $paste->getID());
     return id(new PhabricatorActionListView())->setUser($viewer)->setObject($paste)->setObjectURI($this->getRequest()->getRequestURI())->addAction(id(new PhabricatorActionView())->setName(pht('Edit Paste'))->setIcon('fa-pencil')->setDisabled(!$can_edit)->setWorkflow(!$can_edit)->setHref($this->getApplicationURI('/edit/' . $paste->getID() . '/')))->addAction(id(new PhabricatorActionView())->setName(pht('Fork This Paste'))->setIcon('fa-code-fork')->setDisabled(!$can_fork)->setWorkflow(!$can_fork)->setHref($fork_uri))->addAction(id(new PhabricatorActionView())->setName(pht('View Raw File'))->setIcon('fa-file-text-o')->setHref($file->getBestURI()));
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:7,代码来源:PhabricatorPasteViewController.php

示例7: render

 public function render()
 {
     require_celerity_resource('conpherence-menu-css');
     require_celerity_resource('conpherence-message-pane-css');
     require_celerity_resource('conpherence-participant-pane-css');
     $layout_id = 'conpherence-main-layout';
     $selected_id = null;
     $selected_thread_id = null;
     $selected_thread_phid = null;
     $can_edit_selected = null;
     $nux = null;
     if ($this->thread) {
         $selected_id = $this->thread->getPHID() . '-nav-item';
         $selected_thread_id = $this->thread->getID();
         $selected_thread_phid = $this->thread->getPHID();
         $can_edit_selected = PhabricatorPolicyFilter::hasCapability($this->getUser(), $this->thread, PhabricatorPolicyCapability::CAN_EDIT);
     } else {
         $nux = $this->buildNUXView();
     }
     $this->initBehavior('conpherence-menu', array('baseURI' => $this->baseURI, 'layoutID' => $layout_id, 'selectedID' => $selected_id, 'selectedThreadID' => $selected_thread_id, 'selectedThreadPHID' => $selected_thread_phid, 'canEditSelectedThread' => $can_edit_selected, 'latestTransactionID' => $this->latestTransactionID, 'role' => $this->role, 'hasThreadList' => (bool) $this->threadView, 'hasThread' => (bool) $this->messages, 'hasWidgets' => false));
     $classes = array();
     if (!$this->getUser()->isLoggedIn()) {
         $classes[] = 'conpherence-logged-out';
     }
     if (!$this->getWidgetColumnVisible()) {
         $classes[] = 'hide-widgets';
     }
     $this->initBehavior('conpherence-participant-pane');
     return javelin_tag('div', array('id' => $layout_id, 'sigil' => 'conpherence-layout', 'class' => 'conpherence-layout ' . implode(' ', $classes) . ' conpherence-role-' . $this->role), array(javelin_tag('div', array('id' => 'conpherence-menu-pane', 'class' => 'conpherence-menu-pane phabricator-side-menu', 'sigil' => 'conpherence-menu-pane'), $this->threadView), javelin_tag('div', array('class' => 'conpherence-content-pane'), array(javelin_tag('div', array('class' => 'conpherence-header-pane', 'id' => 'conpherence-header-pane', 'sigil' => 'conpherence-header-pane'), nonempty($this->header, '')), javelin_tag('div', array('class' => 'conpherence-no-threads', 'sigil' => 'conpherence-no-threads', 'style' => 'display: none;'), $nux), javelin_tag('div', array('class' => 'conpherence-participant-pane', 'id' => 'conpherence-participant-pane', 'sigil' => 'conpherence-participant-pane'), array(phutil_tag('div', array('class' => 'widgets-loading-mask'), ''), javelin_tag('div', array('sigil' => 'conpherence-widgets-holder'), ''))), javelin_tag('div', array('class' => 'conpherence-message-pane', 'id' => 'conpherence-message-pane', 'sigil' => 'conpherence-message-pane'), array(javelin_tag('div', array('class' => 'conpherence-messages', 'id' => 'conpherence-messages', 'sigil' => 'conpherence-messages'), nonempty($this->messages, '')), phutil_tag('div', array('class' => 'messages-loading-mask'), ''), javelin_tag('div', array('id' => 'conpherence-form', 'sigil' => 'conpherence-form'), nonempty($this->replyForm, ''))))))));
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:30,代码来源:ConpherenceLayoutView.php

示例8: buildActionList

 private function buildActionList(HarbormasterBuildable $buildable)
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $id = $buildable->getID();
     $list = id(new PhabricatorActionListView())->setUser($viewer)->setObject($buildable)->setObjectURI($buildable->getMonogram());
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $buildable, PhabricatorPolicyCapability::CAN_EDIT);
     $can_restart = false;
     $can_resume = false;
     $can_pause = false;
     $can_abort = false;
     foreach ($buildable->getBuilds() as $build) {
         if ($build->canRestartBuild()) {
             $can_restart = true;
         }
         if ($build->canResumeBuild()) {
             $can_resume = true;
         }
         if ($build->canPauseBuild()) {
             $can_pause = true;
         }
         if ($build->canAbortBuild()) {
             $can_abort = true;
         }
     }
     $restart_uri = "buildable/{$id}/restart/";
     $pause_uri = "buildable/{$id}/pause/";
     $resume_uri = "buildable/{$id}/resume/";
     $abort_uri = "buildable/{$id}/abort/";
     $list->addAction(id(new PhabricatorActionView())->setIcon('fa-repeat')->setName(pht('Restart All Builds'))->setHref($this->getApplicationURI($restart_uri))->setWorkflow(true)->setDisabled(!$can_restart || !$can_edit));
     $list->addAction(id(new PhabricatorActionView())->setIcon('fa-pause')->setName(pht('Pause All Builds'))->setHref($this->getApplicationURI($pause_uri))->setWorkflow(true)->setDisabled(!$can_pause || !$can_edit));
     $list->addAction(id(new PhabricatorActionView())->setIcon('fa-play')->setName(pht('Resume All Builds'))->setHref($this->getApplicationURI($resume_uri))->setWorkflow(true)->setDisabled(!$can_resume || !$can_edit));
     $list->addAction(id(new PhabricatorActionView())->setIcon('fa-exclamation-triangle')->setName(pht('Abort All Builds'))->setHref($this->getApplicationURI($abort_uri))->setWorkflow(true)->setDisabled(!$can_abort || !$can_edit));
     return $list;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:35,代码来源:HarbormasterBuildableViewController.php

示例9: renderSettingsWidgetPaneContent

 private function renderSettingsWidgetPaneContent()
 {
     $viewer = $this->getViewer();
     $conpherence = $this->getConpherence();
     $participant = $conpherence->getParticipantIfExists($viewer->getPHID());
     if (!$participant) {
         $can_join = PhabricatorPolicyFilter::hasCapability($viewer, $conpherence, PhabricatorPolicyCapability::CAN_JOIN);
         if ($can_join) {
             $text = pht('Notification settings are available after joining the room.');
         } else {
             if ($viewer->isLoggedIn()) {
                 $text = pht('Notification settings not applicable to rooms you can not join.');
             } else {
                 $text = pht('Notification settings are available after logging in and joining ' . 'the room.');
             }
         }
         return phutil_tag('div', array('class' => 'no-settings'), $text);
     }
     $default = ConpherenceSettings::EMAIL_ALWAYS;
     $preference = $this->getUserPreferences();
     if ($preference) {
         $default = $preference->getPreference(PhabricatorUserPreferences::PREFERENCE_CONPH_NOTIFICATIONS, ConpherenceSettings::EMAIL_ALWAYS);
     }
     $settings = $participant->getSettings();
     $notifications = idx($settings, 'notifications', $default);
     $options = id(new AphrontFormRadioButtonControl())->addButton(ConpherenceSettings::EMAIL_ALWAYS, ConpherenceSettings::getHumanString(ConpherenceSettings::EMAIL_ALWAYS), '')->addButton(ConpherenceSettings::NOTIFICATIONS_ONLY, ConpherenceSettings::getHumanString(ConpherenceSettings::NOTIFICATIONS_ONLY), '')->setName('notifications')->setValue($notifications);
     $layout = array($options, phutil_tag('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'notifications')), phutil_tag('button', array('type' => 'submit', 'class' => 'notifications-update'), pht('Save')));
     return phabricator_form($viewer, array('method' => 'POST', 'action' => $this->getWidgetURI(), 'sigil' => 'notifications-update'), $layout);
 }
开发者ID:kalbasit,项目名称:phabricator,代码行数:29,代码来源:ConpherenceWidgetController.php

示例10: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $username = $request->getURIData('username');
     $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($username))->needBadges(true)->needProfileImage(true)->needAvailability(true)->executeOne();
     if (!$user) {
         return new Aphront404Response();
     }
     $this->setUser($user);
     $profile = $user->loadUserProfile();
     $picture = $user->getProfileImageURI();
     $profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon());
     $profile_icon = id(new PHUIIconView())->setIcon($profile_icon);
     $profile_title = $profile->getDisplayTitle();
     $header = id(new PHUIHeaderView())->setHeader($user->getFullName())->setSubheader(array($profile_icon, $profile_title))->setImage($picture)->setProfileHeader(true);
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $user, PhabricatorPolicyCapability::CAN_EDIT);
     if ($can_edit) {
         $id = $user->getID();
         $header->setImageEditURL($this->getApplicationURI("picture/{$id}/"));
     }
     $properties = $this->buildPropertyView($user);
     $name = $user->getUsername();
     $feed = $this->buildPeopleFeed($user, $viewer);
     $feed = phutil_tag_div('project-view-feed', $feed);
     $projects = $this->buildProjectsView($user);
     $badges = $this->buildBadgesView($user);
     $columns = id(new PHUITwoColumnView())->addClass('project-view-badges')->setMainColumn(array($properties, $feed))->setSideColumn(array($projects, $badges));
     $nav = $this->getProfileMenu();
     $nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_PROFILE);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->setBorder(true);
     require_celerity_resource('project-view-css');
     $home = phutil_tag('div', array('class' => 'project-view-home'), array($header, $columns));
     return $this->newPage()->setTitle($user->getUsername())->setNavigation($nav)->setCrumbs($crumbs)->appendChild(array($home));
 }
开发者ID:kalsolio,项目名称:phabricator,代码行数:35,代码来源:PhabricatorPeopleProfileViewController.php

示例11: buildActionView

 private function buildActionView(PhabricatorDashboard $dashboard)
 {
     $viewer = $this->getRequest()->getUser();
     $id = $dashboard->getID();
     $actions = id(new PhabricatorActionListView())->setObjectURI($this->getApplicationURI('view/' . $dashboard->getID() . '/'))->setObject($dashboard)->setUser($viewer);
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $dashboard, PhabricatorPolicyCapability::CAN_EDIT);
     $actions->addAction(id(new PhabricatorActionView())->setName(pht('View Dashboard'))->setIcon('fa-columns')->setHref($this->getApplicationURI("view/{$id}/")));
     $actions->addAction(id(new PhabricatorActionView())->setName(pht('Edit Dashboard'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("edit/{$id}/"))->setDisabled(!$can_edit));
     if ($dashboard->isArchived()) {
         $actions->addAction(id(new PhabricatorActionView())->setName(pht('Activate Dashboard'))->setIcon('fa-check')->setHref($this->getApplicationURI("archive/{$id}/"))->setDisabled(!$can_edit)->setWorkflow($can_edit));
     } else {
         $actions->addAction(id(new PhabricatorActionView())->setName(pht('Archive Dashboard'))->setIcon('fa-ban')->setHref($this->getApplicationURI("archive/{$id}/"))->setDisabled(!$can_edit)->setWorkflow($can_edit));
     }
     $actions->addAction(id(new PhabricatorActionView())->setName(pht('Copy Dashboard'))->setIcon('fa-files-o')->setHref($this->getApplicationURI("copy/{$id}/"))->setWorkflow(true));
     $installed_dashboard = id(new PhabricatorDashboardInstall())->loadOneWhere('objectPHID = %s AND applicationClass = %s', $viewer->getPHID(), 'PhabricatorHomeApplication');
     if ($installed_dashboard && $installed_dashboard->getDashboardPHID() == $dashboard->getPHID()) {
         $title_install = pht('Uninstall Dashboard');
         $href_install = "uninstall/{$id}/";
     } else {
         $title_install = pht('Install Dashboard');
         $href_install = "install/{$id}/";
     }
     $actions->addAction(id(new PhabricatorActionView())->setName($title_install)->setIcon('fa-wrench')->setHref($this->getApplicationURI($href_install))->setWorkflow(true));
     $actions->addAction(id(new PhabricatorActionView())->setName(pht('View History'))->setIcon('fa-history')->setHref($this->getApplicationURI("history/{$id}/")));
     return $actions;
 }
开发者ID:fuding,项目名称:phabricator,代码行数:26,代码来源:PhabricatorDashboardManageController.php

示例12: buildCurtain

 private function buildCurtain(PhabricatorApplication $application)
 {
     $viewer = $this->getViewer();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $application, PhabricatorPolicyCapability::CAN_EDIT);
     $key = get_class($application);
     $edit_uri = $this->getApplicationURI("edit/{$key}/");
     $install_uri = $this->getApplicationURI("{$key}/install/");
     $uninstall_uri = $this->getApplicationURI("{$key}/uninstall/");
     $curtain = $this->newCurtainView($application);
     $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Edit Policies'))->setIcon('fa-pencil')->setDisabled(!$can_edit)->setWorkflow(!$can_edit)->setHref($edit_uri));
     if ($application->canUninstall()) {
         if ($application->isInstalled()) {
             $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Uninstall'))->setIcon('fa-times')->setDisabled(!$can_edit)->setWorkflow(true)->setHref($uninstall_uri));
         } else {
             $action = id(new PhabricatorActionView())->setName(pht('Install'))->setIcon('fa-plus')->setDisabled(!$can_edit)->setWorkflow(true)->setHref($install_uri);
             $prototypes_enabled = PhabricatorEnv::getEnvConfig('phabricator.show-prototypes');
             if ($application->isPrototype() && !$prototypes_enabled) {
                 $action->setDisabled(true);
             }
             $curtain->addAction($action);
         }
     } else {
         $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Uninstall'))->setIcon('fa-times')->setWorkflow(true)->setDisabled(true)->setHref($uninstall_uri));
     }
     return $curtain;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:26,代码来源:PhabricatorApplicationDetailViewController.php

示例13: buildActionList

 private function buildActionList(PhabricatorProject $project, array $milestones, array $subprojects)
 {
     $viewer = $this->getViewer();
     $id = $project->getID();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_EDIT);
     $allows_milestones = $project->supportsMilestones();
     $allows_subprojects = $project->supportsSubprojects();
     $view = id(new PhabricatorActionListView())->setUser($viewer);
     if ($allows_milestones && $milestones) {
         $milestone_text = pht('Create Next Milestone');
     } else {
         $milestone_text = pht('Create Milestone');
     }
     $can_milestone = $can_edit && $allows_milestones;
     $milestone_href = "/project/edit/?milestone={$id}";
     $view->addAction(id(new PhabricatorActionView())->setName($milestone_text)->setIcon('fa-plus')->setHref($milestone_href)->setDisabled(!$can_milestone)->setWorkflow(!$can_milestone));
     $can_subproject = $can_edit && $allows_subprojects;
     // If we're offering to create the first subproject, we're going to warn
     // the user about the effects before moving forward.
     if ($can_subproject && !$subprojects) {
         $subproject_href = "/project/warning/{$id}/";
         $subproject_disabled = false;
         $subproject_workflow = true;
     } else {
         $subproject_href = "/project/edit/?parent={$id}";
         $subproject_disabled = !$can_subproject;
         $subproject_workflow = !$can_subproject;
     }
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Create Subproject'))->setIcon('fa-plus')->setHref($subproject_href)->setDisabled($subproject_disabled)->setWorkflow($subproject_workflow));
     return $view;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:31,代码来源:PhabricatorProjectSubprojectsController.php

示例14: render

 public function render()
 {
     $conpherence = $this->conpherence;
     $viewer = $this->getViewer();
     $participants = $conpherence->getParticipants();
     $count = new PhutilNumber(count($participants));
     $handles = $conpherence->getHandles();
     $handles = array_intersect_key($handles, $participants);
     $head_handles = array_select_keys($handles, array($viewer->getPHID()));
     $handle_list = mpull($handles, 'getName');
     natcasesort($handle_list);
     $handles = mpull($handles, null, 'getName');
     $handles = array_select_keys($handles, $handle_list);
     $head_handles = mpull($head_handles, null, 'getName');
     $handles = $head_handles + $handles;
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $conpherence, PhabricatorPolicyCapability::CAN_EDIT);
     $body = array();
     foreach ($handles as $handle) {
         $user_phid = $handle->getPHID();
         if ($user_phid == $viewer->getPHID() || $can_edit) {
             $icon = id(new PHUIIconView())->setIcon('fa-times')->addClass('lightbluetext');
             $remove_html = javelin_tag('a', array('class' => 'remove', 'sigil' => 'remove-person', 'meta' => array('remove_person' => $user_phid, 'action' => 'remove_person')), $icon);
         } else {
             $remove_html = null;
         }
         $body[] = phutil_tag('div', array('class' => 'person-entry grouped'), array(phutil_tag('a', array('class' => 'pic', 'href' => $handle->getURI()), phutil_tag('img', array('src' => $handle->getImageURI()), '')), $handle->renderLink(), $remove_html));
     }
     $new_icon = id(new PHUIIconView())->setIcon('fa-plus-square')->setHref($this->updateURI)->setMetadata(array('widget' => null))->addSigil('conpherence-widget-adder');
     $header = id(new PHUIHeaderView())->setHeader(pht('Participants (%d)', $count))->addClass('widgets-header')->addActionItem($new_icon);
     $content = javelin_tag('div', array('class' => 'widgets-body', 'id' => 'widgets-people', 'sigil' => 'widgets-people'), array($header, $body));
     return $content;
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:32,代码来源:ConpherenceParticipantView.php

示例15: buildActionView

 private function buildActionView(PhabricatorUser $user, DivinerLiveBook $book)
 {
     $can_edit = PhabricatorPolicyFilter::hasCapability($user, $book, PhabricatorPolicyCapability::CAN_EDIT);
     $action_view = id(new PhabricatorActionListView())->setUser($user)->setObject($book)->setObjectURI($this->getRequest()->getRequestURI());
     $action_view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Book'))->setIcon('fa-pencil')->setHref('/book/' . $book->getName() . '/edit/')->setDisabled(!$can_edit));
     return $action_view;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:7,代码来源:DivinerBookController.php


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