* requested path + op.
*
*/
-bool MDSAuthCaps::is_capable(const std::string &path, int uid, bool may_read, bool may_write) const
+bool MDSAuthCaps::is_capable(const std::string &path, int uid,
+ bool may_read, bool may_write) const
{
for (std::vector<MDSCapGrant>::const_iterator i = grants.begin(); i != grants.end(); ++i) {
- if (i->match.match(path, uid)) {
- if ((may_read && !i->spec.read) ||
- (may_write && !i->spec.write)) {
- continue;
- } else {
- return true;
- }
+ if (i->match.match(path, uid) &&
+ i->spec.allows(may_read, may_write)) {
+ return true;
}
}