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