Rename BasePermission to AncestorPermission

This commit is contained in:
Him188 2020-09-09 22:08:15 +08:00
parent 39ef007370
commit 6429e400f1
4 changed files with 7 additions and 6 deletions

View File

@ -10,7 +10,7 @@
package net.mamoe.mirai.console.command package net.mamoe.mirai.console.command
import net.mamoe.mirai.console.command.CommandManager.INSTANCE.unregisterAllCommands import net.mamoe.mirai.console.command.CommandManager.INSTANCE.unregisterAllCommands
import net.mamoe.mirai.console.permission.BasePermission import net.mamoe.mirai.console.permission.AncestorPermission
import net.mamoe.mirai.console.permission.ExperimentalPermission import net.mamoe.mirai.console.permission.ExperimentalPermission
import net.mamoe.mirai.console.permission.PermissionId import net.mamoe.mirai.console.permission.PermissionId
import net.mamoe.mirai.console.permission.PermissionIdNamespace import net.mamoe.mirai.console.permission.PermissionIdNamespace
@ -40,7 +40,8 @@ public interface CommandOwner : PermissionIdNamespace {
*/ */
internal object ConsoleCommandOwner : CommandOwner { internal object ConsoleCommandOwner : CommandOwner {
@ExperimentalPermission @ExperimentalPermission
override val basePermission: PermissionId get() = BasePermission.id override val basePermission: PermissionId
get() = AncestorPermission.id
@ExperimentalPermission @ExperimentalPermission
override fun permissionId(id: String): PermissionId = PermissionId("console", id) override fun permissionId(id: String): PermissionId = PermissionId("console", id)

View File

@ -23,7 +23,7 @@ public abstract class AbstractConcurrentPermissionService<P : Permission> : Perm
protected abstract fun createPermission( protected abstract fun createPermission(
id: PermissionId, id: PermissionId,
description: String, description: String,
base: PermissionId = BasePermission.id base: PermissionId = AncestorPermission.id
): P ): P
override fun get(id: PermissionId): P? = permissions[id] override fun get(id: PermissionId): P? = permissions[id]

View File

@ -29,7 +29,7 @@ public interface Permission {
* 所有权限的父权限. * 所有权限的父权限.
*/ */
@ExperimentalPermission @ExperimentalPermission
public object BasePermission : 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"
@ -52,5 +52,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 = BasePermission.id override val parent: PermissionId = AncestorPermission.id
) : Permission ) : Permission

View File

@ -45,7 +45,7 @@ public interface PermissionService<P : Permission> {
public fun register( public fun register(
id: PermissionId, id: PermissionId,
description: String, description: String,
base: PermissionId = BasePermission.id base: PermissionId = AncestorPermission.id
): P ): P
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////