LuckPerms

LuckPerms

41.4k Downloads

DataTypeFilter.TRANSIENT_ONLY does not appear to work with group inheritance

bloodmc opened this issue ยท 1 comments

commented

Description

As title states, when doing a lookup using DataTypeFilter.TRANSIENT_ONLY it does not seem to check group inheritance.

Reproduction steps

  1. Create a new LP group called 'test'
  2. Set group 'test' as parent of 'default' group with a group weight of -100
  3. Apply transient permission to group 'test'.
  4. Perform a transient permission lookup against the 'default' group for the permission added to 'test'. This lookup should be using DataTypeFilter.TRANSIENT_ONLY in its query.
  5. LuckPerms returns undefined.

Expected behaviour

I would expect the inherited transient value to be returned if not found in 'default'. I would also expect transient permissions to respect group weight (not sure if it does).

Environment details

Local Windows 10 test environment

  • LuckPerms version: 5.3.48 running Paper 1.16.5 build 778

Any other relevant details

If I change DataTypeFilter from TRANSIENT_ONLY to ALL, it returns the permissions in the inherited group.

Here is the relevant code for the call

if (type == PermissionDataType.TRANSIENT) {
    query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).option(DataTypeFilterFunction.KEY, DEFAULT_TRANSIENT_ONLY).context(contexts).build();
} else if (type == PermissionDataType.PERSISTENT) {
    query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).option(DataTypeFilterFunction.KEY, DEFAULT_PERSISTENT_ONLY).context(contexts).build();
} else if (type == PermissionDataType.USER_PERSISTENT) {
    query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).option(DataTypeFilterFunction.KEY, USER_PERSISTENT_ONLY).context(contexts).build();
} else {
    query = QueryOptions.builder(QueryMode.CONTEXTUAL).option(DataQueryOrderFunction.KEY, DEFAULT_DATA_QUERY_ORDER).context(contexts).build();
}

CachedPermissionData cachedData = permissionHolder.getCachedData().getPermissionData(query);
return getGDTristate(cachedData.checkPermission(permission));
commented

TRANSIENT_ONLY will only traverse group inheritances set transiently - this is the intended behaviour.