EXPORTED unsigned long calcarddav_allow_cb(struct request_target_t *tgt)
{
    unsigned long allow = tgt->namespace->allow;

    if (!tgt->userid) {
        allow &= ALLOW_READ_MASK;
    }
    else if (!tgt->collection) {
        allow &= ~(ALLOW_DELETE | ALLOW_PATCH | ALLOW_POST | ALLOW_WRITE);
    }
    else if (!tgt->resource) {
        allow &= ~(ALLOW_MKCOL | ALLOW_PATCH);
    }
    else {
        allow &= ~(ALLOW_MKCOL | ALLOW_POST);
    }

    return allow;
}
EXPORTED unsigned long calcarddav_allow_cb(struct request_target_t *tgt)
{
    unsigned long allow = tgt->namespace->allow;

    if (!tgt->userid) {
        allow &= ALLOW_READ_MASK;
    }
    else if (!tgt->collection) {
        allow &= ~(ALLOW_DELETE | ALLOW_PATCH | ALLOW_POST | ALLOW_WRITE);
    }
    else if (!tgt->resource) {
        allow &= ~(ALLOW_MKCOL | ALLOW_PATCH);
    }
    else {
        allow &= ~(ALLOW_MKCOL | ALLOW_POST);
    }

    return allow;
}