for (Grant grant : mGrants) if (!inheritedOnly || grant.isGrantInherited()) rightsGranted |= grant.getGrantedRights(authuser);
boolean inheritedRead = false; for (Grant grant : mGrants) { boolean inherited = grant.isGrantInherited(); if (!inheritedOnly || inherited) { short rights = grant.getGrantedRights(authuser); rightsGranted |= rights; if (inherited && (rights & RIGHT_READ) != 0) inheritedRead = true; } } if (inheritedRead && (rightsGranted & RIGHT_INSERT) != 0) rightsGranted |= RIGHT_SUBFOLDER;
    Short getGrantedRights(Account authuser, boolean inheritedOnly) throws ServiceException {        if (mGrants.isEmpty())            return null;        short rightsGranted = 0;        for (Grant grant : mGrants)            if (!inheritedOnly || grant.isGrantInherited())                rightsGranted |= grant.getGrantedRights(authuser);        return new Short(rightsGranted);    }