Table of Contents

Interface IPermissionManager

Namespace
Vintagestory.API.Server
Assembly
VintagestoryAPI.dll
public interface IPermissionManager
Extension Methods

Methods

AddPrivilegeToGroup(string, string)

Add given privilege to given group, granting everyone in this group access to this privilege. This setting is only active for the current server session and lost during a server restart/shutdown.

bool AddPrivilegeToGroup(string groupCode, string privilegeCode)

Parameters

groupCode string
privilegeCode string

Returns

bool

DenyPrivilege(string, string)

Actively denies a privilege from a player, overrides privileges granted by a role. Does not however override non permanent privileges

bool DenyPrivilege(string playerUID, string code)

Parameters

playerUID string
code string

Returns

bool

False if player was not found

DropTemporaryPrivilege(string)

Revokes a privilege that has been previously granted to all players. Does not revoke privileges granted from a group. Does nothing if this privilege hasn't been previously granted.

void DropTemporaryPrivilege(string code)

Parameters

code string

GetPlayerPermissionLevel(int)

Returns the players permission level

int GetPlayerPermissionLevel(int player)

Parameters

player int

Returns

int

GetRole(string)

Retrieve a role by its role code

IPlayerRole GetRole(string code)

Parameters

code string

Returns

IPlayerRole

GrantPrivilege(string, string, bool)

Grant a privilege to an individual connected player.

bool GrantPrivilege(string playerUID, string code, bool permanent = false)

Parameters

playerUID string
code string
permanent bool

Wether to store this privilege permanently. Otherwise only valid for the active server session.

Returns

bool

False if player was not found

GrantTemporaryPrivilege(string)

Grants privilege to all players connected or yet to connect. This setting is only active for the current server session and lost during a server restart/shutdown.

void GrantTemporaryPrivilege(string code)

Parameters

code string

RegisterPrivilege(string, string, bool)

Registers a user privilege with the server. Is only active for the current server session and lost during a server restart/shutdown, so register it during server startup. New privileges are auto-granted to admins and the server console.

void RegisterPrivilege(string code, string shortdescription, bool adminAutoGrant = true)

Parameters

code string

Privilege to register

shortdescription string

Short description

adminAutoGrant bool

By default, super users are automatically granted all privileges. Set this value to false to change that

RemovePrivilegeDenial(string, string)

Removes a previously set privilege denial, if any was set.

bool RemovePrivilegeDenial(string playerUID, string code)

Parameters

playerUID string
code string

Returns

bool

RemovePrivilegeFromGroup(string, string)

Revokes given privilege to given group, revoking everyones access to this privilege inside this group

bool RemovePrivilegeFromGroup(string groupCode, string privilegeCode)

Parameters

groupCode string
privilegeCode string

Returns

bool

RevokePrivilege(string, string, bool)

Revokes a privilege that has been previously granted to this player. Does not revoke privileges granted from a group. Does nothing if the player does not have given privilege.

bool RevokePrivilege(string playerUID, string code, bool permanent = false)

Parameters

playerUID string
code string
permanent bool

If true it removes a previously granted permanent privilege. If false it removes a previously granted temporary privilege.

Returns

bool

False if player was not found

SetRole(IServerPlayer, string)

Set given role for given player. Role must exist in the serverconfig.json. For a list of roles, read sapi.Config.Roles

void SetRole(IServerPlayer player, string roleCode)

Parameters

player IServerPlayer
roleCode string

SetRole(IServerPlayer, IPlayerRole)

Set given role for given player. Role must exist in the serverconfig.json. For a list of roles, read sapi.Config.Roles

void SetRole(IServerPlayer player, IPlayerRole role)

Parameters

player IServerPlayer
role IPlayerRole