diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt index 3385f4cc9..afdd1bc81 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/Permission.kt @@ -22,7 +22,7 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI public interface Permission { public val id: PermissionId public val description: String - public val parent: PermissionId + public val parentId: PermissionId } /** @@ -33,15 +33,14 @@ public object AncestorPermission : Permission { override val id: PermissionId = PermissionId("*", "*") override val description: String get() = "The parent of any permission" - override val parent: PermissionId get() = id + override val parentId: PermissionId get() = id } @ConsoleExperimentalAPI @ExperimentalPermission public fun Permission.parentsWithSelfSequence(): Sequence = generateSequence(this) { p -> - p.parent.let { PermissionService.INSTANCE[it] } - ?.takeIf { parent -> parent != p } + p.parentId.findCorrespondingPermission()?.takeIf { parent -> parent != p } } /** @@ -52,5 +51,5 @@ public fun Permission.parentsWithSelfSequence(): Sequence = public class PermissionImpl( override val id: PermissionId, override val description: String, - override val parent: PermissionId = AncestorPermission.id + override val parentId: PermissionId = AncestorPermission.id ) : Permission \ No newline at end of file