Skip to content

Commit

Permalink
Remove ServerCookieIface::test_privilege
Browse files Browse the repository at this point in the history
Use CookieIface::testPrivilege instead

Change-Id: Ifd8b5c4b2f8d154c9d9f2390744c2d0392fc2297
Reviewed-on: http://review.couchbase.org/c/kv_engine/+/159022
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>
  • Loading branch information
trondn authored and daverigby committed Aug 12, 2021
1 parent ae75f89 commit a9c94f1
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 49 deletions.
7 changes: 0 additions & 7 deletions auditd/tests/testauditd.cc
Expand Up @@ -85,13 +85,6 @@ class AuditMockServerCookieApi : public ServerCookieIface {
std::optional<CollectionID> cid) override {
throw std::runtime_error("Not implemented");
}
cb::rbac::PrivilegeAccess test_privilege(
const CookieIface& cookie,
cb::rbac::Privilege privilege,
std::optional<ScopeID> sid,
std::optional<CollectionID> cid) override {
throw std::runtime_error("Not implemented");
}
uint32_t get_privilege_context_revision(
const CookieIface& cookie) override {
throw std::runtime_error("Not implemented");
Expand Down
8 changes: 0 additions & 8 deletions daemon/server_api.cc
Expand Up @@ -138,14 +138,6 @@ struct ServerCookieApi : public ServerCookieIface {
return getCookie(cookie).checkPrivilege(privilege, sid, cid);
}

cb::rbac::PrivilegeAccess test_privilege(
const CookieIface& cookie,
cb::rbac::Privilege privilege,
std::optional<ScopeID> sid,
std::optional<CollectionID> cid) override {
return getCookie(cookie).testPrivilege(privilege, sid, cid);
}

uint32_t get_privilege_context_revision(
const CookieIface& cookie) override {
return getCookie(cookie).getPrivilegeContext().getGeneration();
Expand Down
3 changes: 1 addition & 2 deletions engines/ep/src/ep_engine.cc
Expand Up @@ -4944,8 +4944,7 @@ cb::engine_errc EventuallyPersistentEngine::testPrivilege(
std::optional<ScopeID> sid,
std::optional<CollectionID> cid) const {
try {
switch (serverApi->cookie->test_privilege(cookie, priv, sid, cid)
.getStatus()) {
switch (cookie.testPrivilege(priv, sid, cid).getStatus()) {
case cb::rbac::PrivilegeAccess::Status::Ok:
return cb::engine_errc::success;
case cb::rbac::PrivilegeAccess::Status::Fail:
Expand Down
7 changes: 0 additions & 7 deletions engines/ep/tests/module_tests/dcp_test.cc
Expand Up @@ -116,13 +116,6 @@ class WrappedServerCookieIface : public ServerCookieIface {
std::optional<CollectionID> cid) override {
return wrapped->check_privilege(cookie, privilege, sid, cid);
}
cb::rbac::PrivilegeAccess test_privilege(
const CookieIface& cookie,
cb::rbac::Privilege privilege,
std::optional<ScopeID> sid,
std::optional<CollectionID> cid) override {
return wrapped->test_privilege(cookie, privilege, sid, cid);
}
uint32_t get_privilege_context_revision(
const CookieIface& cookie) override {
return wrapped->get_privilege_context_revision(cookie);
Expand Down
17 changes: 0 additions & 17 deletions include/memcached/server_cookie_iface.h
Expand Up @@ -140,23 +140,6 @@ struct ServerCookieIface {
virtual void setDcpFlowControlBufferSize(const CookieIface& cookie,
std::size_t size) = 0;

/**
* Test if the cookie have the specified privilege in it's active set.
*
* @param cookie the cookie sent to the engine for an operation
* @param privilege the privilege to check for
* @param sid the scope id (optional for bucket tests)
* @param cid the collection id (optional for scope/bucket tests)
* @throws invalid_argument if cid defined but not sid
* @return PrivilegeAccess::Ok if the cookie have the privilege in its
* active set. PrivilegeAccess::Fail/FailNoPrivileges otherwise
*/
virtual cb::rbac::PrivilegeAccess test_privilege(
const CookieIface& cookie,
cb::rbac::Privilege privilege,
std::optional<ScopeID> sid,
std::optional<CollectionID> cid) = 0;

/// Get the revision number for the privilege context for the cookie to
/// allow the engine to cache the result of a privilege check if locating
/// the sid / cid is costly.
Expand Down
8 changes: 0 additions & 8 deletions programs/engine_testapp/mock_server.cc
Expand Up @@ -222,14 +222,6 @@ struct MockServerCookieApi : public ServerCookieIface {
return cookie.testPrivilege(privilege, sid, cid);
}

cb::rbac::PrivilegeAccess test_privilege(
const CookieIface& cookie,
cb::rbac::Privilege privilege,
std::optional<ScopeID> sid,
std::optional<CollectionID> cid) override {
return cookie.testPrivilege(privilege, sid, cid);
}

uint32_t get_privilege_context_revision(
const CookieIface& cookie) override {
return privilege_context_revision;
Expand Down

0 comments on commit a9c94f1

Please sign in to comment.