本文整理汇总了PHP中Tracker::userIsAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker::userIsAdmin方法的具体用法?PHP Tracker::userIsAdmin怎么用?PHP Tracker::userIsAdmin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker
的用法示例。
在下文中一共展示了Tracker::userIsAdmin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateArtifacts
public function updateArtifacts(PFUser $user, Codendi_Request $request)
{
if ($this->tracker->userIsAdmin($user)) {
$masschange_aids = $request->get('masschange_aids');
if (empty($masschange_aids)) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_masschange_detail', 'no_items_selected'));
$GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker->getId());
}
$unsubscribe = $request->get('masschange-unsubscribe-option');
if ($unsubscribe) {
$this->unsubscribeUserFromEachArtifactNotification($user, $request, $masschange_aids);
}
$send_notifications = $this->getSendNotificationsFromRequest($request);
$masschange_data = $request->get('artifact');
if (!$unsubscribe && empty($masschange_data)) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_masschange_detail', 'no_items_selected'));
$GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker->getId());
}
$comment = $request->get('artifact_masschange_followup_comment');
$masschange_values_extractor = new Tracker_MasschangeDataValueExtractor();
$new_fields_data = $masschange_values_extractor->getNewValues($masschange_data);
if (count($new_fields_data) > 0 || $comment !== '') {
$comment_format = $request->get('comment_formatmass_change');
$this->tracker->updateArtifactsMasschange($user, $masschange_aids, $new_fields_data, $comment, $send_notifications, $comment_format);
}
$GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker->getId());
} else {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
$GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->tracker_report->getId());
}
}
示例2: userCanViewTracker
public function userCanViewTracker(PFUser $user, Tracker $tracker)
{
if ($user->isSuperUser()) {
return true;
}
if ($tracker->userIsAdmin($user)) {
return true;
}
$project = $tracker->getProject();
if ($this->userIsRestrictedAndNotMemberOfProject($user, $project) || $this->userIsNotMemberOfPrivateProject($user, $project)) {
return false;
}
foreach ($tracker->getPermissionsByUgroupId() as $ugroup_id => $permission_types) {
if ($user->isMemberOfUGroup($ugroup_id, $tracker->getGroupId())) {
return true;
}
}
return false;
}