本文整理汇总了PHP中PFUser类的典型用法代码示例。如果您正苦于以下问题:PHP PFUser类的具体用法?PHP PFUser怎么用?PHP PFUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PFUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkUserIsSiteadmin
private function checkUserIsSiteadmin(PFUser $user, Response $response)
{
if (!$user->isSuperUser()) {
$response->addFeedback(Feedback::ERROR, $GLOBALS['Language']->getText('global', 'perm_denied'));
$response->redirect('/');
}
}
示例2: generateTokenForUser
/**
* @return Rest_Token
*/
public function generateTokenForUser(PFUser $user)
{
$number_generator = new RandomNumberGenerator();
$token = $number_generator->getNumber();
$this->token_dao->addTokenForUserId($user->getId(), $token, $_SERVER['REQUEST_TIME']);
return new Rest_Token($user->getId(), $token);
}
示例3: __construct
public function __construct(PFUser $user)
{
$hp = Codendi_HTMLPurifier::instance();
$user_name = $hp->purify($user->getRealName());
$steps = array(new Tuleap_Tour_Step($GLOBALS['Language']->getText('my_tour', 'welcome_title'), $GLOBALS['Language']->getText('my_tour', 'welcome', $user_name)), new Tuleap_Tour_Step($GLOBALS['Language']->getText('my_tour', 'my_personal_page_title'), $GLOBALS['Language']->getText('my_tour', 'my_personal_page'), 'bottom', 'ul.nav > li:first-child'), new Tuleap_Tour_Step($GLOBALS['Language']->getText('my_tour', 'projects_title'), $GLOBALS['Language']->getText('my_tour', 'projects'), 'bottom', 'ul.nav > li.projects-nav'), new Tuleap_Tour_Step($GLOBALS['Language']->getText('my_tour', 'help_title'), $GLOBALS['Language']->getText('my_tour', 'help'), 'bottom', 'ul.nav > li.help-nav'), new Tuleap_Tour_Step($GLOBALS['Language']->getText('my_tour', 'search_title'), $GLOBALS['Language']->getText('my_tour', 'search'), 'bottom', 'ul.nav.pull-right > form'), new Tuleap_Tour_Step($GLOBALS['Language']->getText('my_tour', 'user_menu_title'), $GLOBALS['Language']->getText('my_tour', 'user_menu'), 'bottom', 'ul.nav.pull-right > li.user-menu'), new Tuleap_Tour_Step($GLOBALS['Language']->getText('my_tour', 'end_tour_title'), $GLOBALS['Language']->getText('my_tour', 'end_tour')));
parent::__construct(self::TOUR_NAME, $steps);
}
示例4: addUserAsProjectAdmin
public function addUserAsProjectAdmin(Project $project, PFUser $user)
{
$project_id = $this->da->escapeInt($project->getId());
$user_id = $this->da->escapeInt($user->getId());
$sql = "UPDATE user_group\n SET admin_flags = 'A'\n WHERE group_id = {$project_id}\n AND user_id = {$user_id}";
return $this->update($sql);
}
示例5: __construct
public function __construct(PFUser $current_user, Project $project, $milestone_id)
{
$this->user_id = $current_user->getId();
$this->lang = $this->getLanguageAbbreviation($current_user);
$this->project_id = $project->getId();
$this->milestone_id = $milestone_id;
$this->view_mode = $current_user->getPreference('agiledashboard_planning_item_view_mode_' . $this->project_id);
}
示例6: userPasswordHasExpired
private function userPasswordHasExpired(PFUser $user)
{
$expiration_date = $this->getPasswordExpirationDate();
if ($expiration_date && $user->getLastPwdUpdate() < $expiration_date) {
return true;
}
return false;
}
示例7: __construct
public function __construct(Project $project, PFUser $pfuser, $suffix)
{
parent::__construct($pfuser->toRow());
$this->setStatus(PFUser::STATUS_RESTRICTED);
$this->setRealName(self::REAL_NAME);
$this->setUserName(self::NAME_PREFIX . $project->getUnixName() . $suffix);
$this->project = $project;
}
示例8: removePair
/**
* Remove all pair done with user account
*/
public function removePair(PFUser $user)
{
$user_id = $user->getId();
$dar = $this->dao->searchOpenidUrlsForUserId($user_id);
if ($dar->count()) {
$row = $dar->getRow();
$this->dao->removeConnexionStringForUserId($row['connexion_string'], $user_id);
}
}
示例9: getDispatchableFromRequest
/**
* Return the Tracker object that correspond to the given request
*
* @param Codendi_Request $request The request
* @param PFUser $user Who access the request
*
* @return Tracker_Dispatchable_Interface
*/
function getDispatchableFromRequest(Codendi_Request $request, PFUser $user)
{
if ((int) $request->get('aid')) {
if ($artifact = $this->getArtifactFactory()->getArtifactByid($request->get('aid'))) {
return $artifact;
} else {
throw new Tracker_ResourceDoesntExistException($GLOBALS['Language']->getText('plugin_tracker_common_type', 'artifact_not_exist'));
}
} else {
if ((int) $request->get('report')) {
$store_in_session = true;
if ($request->exist('store_in_session')) {
$store_in_session = (bool) $request->get('store_in_session');
}
if ($report = $this->getArtifactReportFactory()->getReportById($request->get('report'), $user->getId(), $store_in_session)) {
return $report;
} else {
throw new Tracker_ResourceDoesntExistException($GLOBALS['Language']->getText('plugin_tracker_common_type', 'report_not_exist'));
}
} else {
if ((int) $request->get('tracker') || (int) $request->get('atid')) {
$tracker_id = (int) $request->get('tracker');
if (!$tracker_id) {
$tracker_id = (int) $request->get('atid');
}
if ($tracker = $this->getTrackerFactory()->getTrackerByid($tracker_id)) {
return $tracker;
} else {
throw new Tracker_ResourceDoesntExistException($GLOBALS['Language']->getText('plugin_tracker_common_type', 'tracker_not_exist'));
}
} else {
if ((int) $request->get('formElement')) {
if ($formElement = $this->getTracker_FormElementFactory()->getFormElementByid($request->get('formElement'))) {
return $formElement;
}
} else {
if ($request->get('func') == 'new-artifact-link') {
if ($artifact = Tracker_ArtifactFactory::instance()->getArtifactByid($request->get('id'))) {
return $artifact;
} else {
throw new Tracker_ResourceDoesntExistException($GLOBALS['Language']->getText('plugin_tracker_common_type', 'artifact_not_exist'));
}
} else {
if ((int) $request->get('link-artifact-id')) {
if ($artifact = Tracker_ArtifactFactory::instance()->getArtifactByid($request->get('link-artifact-id'))) {
return $artifact;
} else {
throw new Tracker_ResourceDoesntExistException($GLOBALS['Language']->getText('plugin_tracker_common_type', 'artifact_not_exist'));
}
}
}
}
}
}
}
throw new Tracker_NoMachingResourceException();
}
示例10: createArtifact
private function createArtifact(PFUser $current_user)
{
$email = null;
if ($current_user->isAnonymous()) {
$email = $this->request->get('email');
}
$fields_data = $this->request->get('artifact');
$this->tracker->augmentDataFromRequest($fields_data);
return $this->tracker_artifact_factory->createArtifact($this->tracker, $fields_data, $current_user, $email);
}
示例11: notifyOnDisable
/**
* Send a mail when PDF Watermarking is disabled.
*
* @param Docman_Item $item
* @param PFUser $currentUser
*
* @return void
*/
public function notifyOnDisable($item, $currentUser, $defaultUrl)
{
$admins = $this->getPeopleToNotifyWhenWatermarkingIsDisabled($item);
$link = get_server_url() . $defaultUrl . '&action=details&id=' . $item->getId();
$mail = new Mail();
$mail->setTo(implode(',', $admins));
$mail->setSubject($GLOBALS['Language']->getText('plugin_docmanwatermark', 'email_disable_watermark_subject', array($item->getTitle())));
$mail->setBody($GLOBALS['Language']->getText('plugin_docmanwatermark', 'email_disable_watermark_body', array($item->getTitle(), $currentUser->getRealname(), $link)));
$mail->send();
}
示例12: exportUser
public function exportUser(PFUser $user, SimpleXMLElement $members_node, $child_name)
{
if ($user->getLdapId()) {
$member_node = $members_node->addChild($child_name, $user->getLdapId());
$member_node->addAttribute('format', 'ldap');
} else {
$member_node = $members_node->addChild($child_name, $user->getUserName());
$member_node->addAttribute('format', 'username');
}
}
示例13: createArtifact
/**
* Add an artefact in the tracker
*
* @param Tracker_IDisplayTrackerLayout $layout
* @param Codendi_Request $request
* @param PFUser $user
*
* @return Tracker_Artifact the new artifact
*/
private function createArtifact(Tracker_IDisplayTrackerLayout $layout, $request, $user)
{
$email = null;
if ($user->isAnonymous()) {
$email = $request->get('email');
}
$fields_data = $request->get('artifact');
$this->tracker->augmentDataFromRequest($fields_data);
return $this->artifact_factory->createArtifact($this->tracker, $fields_data, $user, $email);
}
示例14: getVariantForUser
public function getVariantForUser(PFUser $user)
{
$variant = $user->getPreference(self::PREFERENCE_NAME);
if (!$variant) {
return $this->default;
}
if (!$this->isAllowed($variant)) {
return $this->default;
}
return $variant;
}
示例15: __construct
public function __construct(PFUser $current_user, Project $project, $milestone_id, $milestone_representation, $paginated_backlog_items_representations, $paginated_milestones_representations)
{
$this->user_id = $current_user->getId();
$this->lang = $this->getLanguageAbbreviation($current_user);
$this->project_id = $project->getId();
$this->milestone_id = $milestone_id;
$this->view_mode = $current_user->getPreference('agiledashboard_planning_item_view_mode_' . $this->project_id);
$this->milestone_representation = json_encode($milestone_representation);
$this->paginated_backlog_items_representations = json_encode($paginated_backlog_items_representations);
$this->paginated_milestones_representations = json_encode($paginated_milestones_representations);
}