public function hasAccessPermissions($user, $environment = null, $modify = null)
{
switch ($this->getScope()) {
case static::SCOPE_ACCOUNT:
return $this->accountId == $user->accountId && (empty($environment) || !$modify);
case static::SCOPE_ENVIRONMENT:
return $environment ? $this->envId == $environment->id : $user->hasAccessToEnvironment($this->envId);
case static::SCOPE_SCALR:
return !$modify;
default:
return false;
}
}