code: func rolesInPrefix(c context.Context, metas []*api.PrefixMetadata) ([]api.Role, error) {
  	roles := roleSet()
  	for _, meta := range metas {
  		for _, acl := range meta.Acls {
  			if _, ok := roles[acl.Role]; ok {
  				continue // seen this role already
  			}
  			switch yes, err := isInACL(c, acl); {
  			case err != nil:
  				return nil, err
  			case yes:
  				// Add acl.Role and all roles implied by it to 'roles' set.
  				for _, r := range impliedRoles[acl.Role] {
  					roles[r] = struct{}{}
  				}
  			}
  		}
  	}
  
  	// Arrange the result in the order of Role enum definition.
  	out := make([]api.Role, 0, len(roles))
  	for r := api.Role_READER; r <= api.Role_OWNER; r++ {
  		if _, ok := roles[r]; ok {
  			out = append(out, r)
  		}
  	}
  	return out, nil
  }
docs: // rolesInPrefix returns a union of roles the caller has in given supplied
  // PrefixMetadata objects.
  //
  // It understands the role inheritance defined by impliedRoles map.
  //
  // Returns only transient errors.