added method in PermGroup to get groups that inherit the current group
This commit is contained in:
parent
41878b72f9
commit
862c164cf3
@ -1,5 +1,6 @@
|
||||
package fr.pandacube.lib.permissions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -35,6 +36,17 @@ public final class PermGroup extends PermEntity {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the groups that directly inherits from this group.
|
||||
* @return the groups that directly inherits from this group.
|
||||
*/
|
||||
public List<PermGroup> getInheritedGroups() {
|
||||
CachedGroup thisCG = getBackendEntity();
|
||||
return fromCachedGroups(Permissions.backendReader.getGroups().stream()
|
||||
.filter(cg -> cg.inheritances.contains(thisCG))
|
||||
.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if this group is a default group.
|
||||
* A player inherits all default groups when they don’t explicitely inherit from at least one group.
|
||||
|
Loading…
Reference in New Issue
Block a user