本文整理汇总了PHP中Scalr_Account_User::isInTeam方法的典型用法代码示例。如果您正苦于以下问题:PHP Scalr_Account_User::isInTeam方法的具体用法?PHP Scalr_Account_User::isInTeam怎么用?PHP Scalr_Account_User::isInTeam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scalr_Account_User
的用法示例。
在下文中一共展示了Scalr_Account_User::isInTeam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isFarmAllowed
/**
* @param DBFarm $dbFarm
* @param string $permissionId
* @return bool
*/
protected function isFarmAllowed(DBFarm $dbFarm = null, $permissionId = null)
{
$acl = \Scalr::getContainer()->acl;
if (is_null($dbFarm)) {
return $acl->isUserAllowedByEnvironment($this->user, $this->Environment, \Scalr\Acl\Acl::RESOURCE_FARMS, $permissionId) || $acl->isUserAllowedByEnvironment($this->user, $this->Environment, \Scalr\Acl\Acl::RESOURCE_TEAM_FARMS, $permissionId) || $acl->isUserAllowedByEnvironment($this->user, $this->Environment, \Scalr\Acl\Acl::RESOURCE_OWN_FARMS, $permissionId);
} else {
if (!$dbFarm instanceof DBFarm) {
throw new \InvalidArgumentException(sprintf('First argument should be instance of DBFarm or null'));
}
$result = $acl->isUserAllowedByEnvironment($this->user, $this->Environment, \Scalr\Acl\Acl::RESOURCE_FARMS, $permissionId);
if (!$result && $dbFarm->teamId && $this->user->isInTeam($dbFarm->teamId)) {
$result = $acl->isUserAllowedByEnvironment($this->user, $this->Environment, \Scalr\Acl\Acl::RESOURCE_TEAM_FARMS, $permissionId);
}
if (!$result && $dbFarm->createdByUserId && $this->user->id == $dbFarm->createdByUserId) {
$result = $acl->isUserAllowedByEnvironment($this->user, $this->Environment, \Scalr\Acl\Acl::RESOURCE_OWN_FARMS, $permissionId);
}
return $result;
}
}