本文整理汇总了PHP中Tracker::getPermissionsByUgroupId方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker::getPermissionsByUgroupId方法的具体用法?PHP Tracker::getPermissionsByUgroupId怎么用?PHP Tracker::getPermissionsByUgroupId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker
的用法示例。
在下文中一共展示了Tracker::getPermissionsByUgroupId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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
$this->getDao()->startTransaction();
$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->log_priority_changes, $tracker->stop_notification, $tracker->color, $tracker->isEmailgatewayEnabled());
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 rules
if (isset($tracker->rules)) {
$this->getRuleFactory()->saveObject($tracker->rules, $trackerDB);
}
//create workflow
if (isset($tracker->workflow)) {
WorkflowFactory::instance()->saveObject($tracker->workflow, $trackerDB);
}
//tracker permissions
if ($tracker->permissionsAreCached()) {
$pm = PermissionsManager::instance();
foreach ($tracker->getPermissionsByUgroupId() as $ugroup => $permissions) {
foreach ($permissions as $permission) {
$pm->addPermission($permission, $tracker_id, $ugroup);
}
}
} else {
$this->saveTrackerDefaultPermission($tracker_id);
}
$this->postCreateActions($trackerDB);
}
$this->getDao()->commit();
return $tracker_id;
}