mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Rename Permission.parent to Permission.parentId
This commit is contained in:
parent
6429e400f1
commit
a6109bb301
@ -22,7 +22,7 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI
|
|||||||
public interface Permission {
|
public interface Permission {
|
||||||
public val id: PermissionId
|
public val id: PermissionId
|
||||||
public val description: String
|
public val description: String
|
||||||
public val parent: PermissionId
|
public val parentId: PermissionId
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,15 +33,14 @@ public object AncestorPermission :
|
|||||||
Permission {
|
Permission {
|
||||||
override val id: PermissionId = PermissionId("*", "*")
|
override val id: PermissionId = PermissionId("*", "*")
|
||||||
override val description: String get() = "The parent of any permission"
|
override val description: String get() = "The parent of any permission"
|
||||||
override val parent: PermissionId get() = id
|
override val parentId: PermissionId get() = id
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConsoleExperimentalAPI
|
@ConsoleExperimentalAPI
|
||||||
@ExperimentalPermission
|
@ExperimentalPermission
|
||||||
public fun Permission.parentsWithSelfSequence(): Sequence<Permission> =
|
public fun Permission.parentsWithSelfSequence(): Sequence<Permission> =
|
||||||
generateSequence(this) { p ->
|
generateSequence(this) { p ->
|
||||||
p.parent.let { PermissionService.INSTANCE[it] }
|
p.parentId.findCorrespondingPermission()?.takeIf { parent -> parent != p }
|
||||||
?.takeIf { parent -> parent != p }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,5 +51,5 @@ public fun Permission.parentsWithSelfSequence(): Sequence<Permission> =
|
|||||||
public class PermissionImpl(
|
public class PermissionImpl(
|
||||||
override val id: PermissionId,
|
override val id: PermissionId,
|
||||||
override val description: String,
|
override val description: String,
|
||||||
override val parent: PermissionId = AncestorPermission.id
|
override val parentId: PermissionId = AncestorPermission.id
|
||||||
) : Permission
|
) : Permission
|
Loading…
Reference in New Issue
Block a user