Skip to content

Commit

Permalink
keyring: implement get_caps()
Browse files Browse the repository at this point in the history
Simple accessor, mirrors KeyServerData.

Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Jun 6, 2012
1 parent ca433f2 commit 5d520f1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/auth/KeyRing.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ class KeyRing : public KeyStore {
CryptoKey& secret) const {
return false;
}
bool get_caps(const EntityName& name,
const std::string& type, AuthCapsInfo& caps) const {
map<EntityName, EntityAuth>::const_iterator k = keys.find(name);
if (k == keys.end())
return false;
map<string,bufferlist>::const_iterator i = k->second.caps.find(type);
if (i != k->second.caps.end()) {
caps.caps = i->second;
}
return true;
}

// modifiers
void add(const EntityName& name, EntityAuth &a) {
Expand Down

0 comments on commit 5d520f1

Please sign in to comment.