/** * @param WebhookConfig $webhook * @return bool * @throws Exception */ private function canManageWebhook($webhook) { return $this->request->getScope() == $webhook->getScope() && ($webhook->getScope() == WebhookConfig::SCOPE_SCALR || $webhook->getScope() == WebhookConfig::SCOPE_ACCOUNT && $webhook->accountId == $this->user->getAccountId() && $this->request->isAllowed(Acl::RESOURCE_WEBHOOKS_ACCOUNT, Acl::PERM_WEBHOOKS_ACCOUNT_MANAGE) || $webhook->getScope() == WebhookConfig::SCOPE_ENVIRONMENT && $webhook->envId == $this->getEnvironmentId() && $webhook->accountId == $this->user->getAccountId() && $this->request->isAllowed(Acl::RESOURCE_WEBHOOKS_ENVIRONMENT, Acl::PERM_WEBHOOKS_ENVIRONMENT_MANAGE)); }
/** * @param WebhookConfig $webhook * @throws Exception */ private function canEditWebhook($webhook) { return $this->request->getScope() == $webhook->getScope() && ($webhook->getScope() == WebhookConfig::SCOPE_SCALR || $webhook->getScope() == WebhookConfig::SCOPE_ACCOUNT && $webhook->accountId == $this->user->getAccountId() || $webhook->getScope() == WebhookConfig::SCOPE_ENVIRONMENT && $webhook->envId == $this->getEnvironmentId() && $webhook->accountId == $this->user->getAccountId()); }