C# Класс TShockAPI.DB.UserManager

UserManager - Methods for dealing with database users and other user functionality within TShock.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddUser ( User user ) : void

Adds a given username to the database

GetUser ( User user ) : User

Gets a user object by a user object.

GetUserByID ( int id ) : User

Gets a user object by their user ID.

GetUserByName ( string name ) : User

Gets a user object by name.

GetUserID ( string username ) : int

Gets the database ID of a given user object from the database.

GetUsers ( ) : List

Gets all users from the database.

GetUsersByName ( string username, bool notAtStart = false ) : List

Gets all users from the database with a username that starts with or contains username

RemoveUser ( User user ) : void

Removes a given username from the database

SetUserGroup ( User user, string group ) : void

Sets the group for a given username

SetUserPassword ( User user, string password ) : void

Sets the Hashed Password for a given username

SetUserUUID ( User user, string uuid ) : void

Sets the UUID for a given username

UpdateLogin ( User user ) : void

Updates the last accessed time for a database user to the current time.

UserManager ( IDbConnection db ) : System

Creates a UserManager object. During instantiation, this method will verify the table structure against the format below.

Приватные методы

Метод Описание
LoadUserFromResult ( User user, QueryResult result ) : User

Fills out the fields of a User object with the results from a QueryResult object.

Описание методов

AddUser() публичный Метод

Adds a given username to the database
public AddUser ( User user ) : void
user User User user
Результат void

GetUser() публичный Метод

Gets a user object by a user object.
public GetUser ( User user ) : User
user User The user object to search by.
Результат User

GetUserByID() публичный Метод

Gets a user object by their user ID.
public GetUserByID ( int id ) : User
id int The user's ID.
Результат User

GetUserByName() публичный Метод

Gets a user object by name.
public GetUserByName ( string name ) : User
name string The user's name.
Результат User

GetUserID() публичный Метод

Gets the database ID of a given user object from the database.
public GetUserID ( string username ) : int
username string The username of the user to query for.
Результат int

GetUsers() публичный Метод

Gets all users from the database.
public GetUsers ( ) : List
Результат List

GetUsersByName() публичный Метод

Gets all users from the database with a username that starts with or contains username
public GetUsersByName ( string username, bool notAtStart = false ) : List
username string Rough username search. "n" will match "n", "na", "nam", "name", etc
notAtStart bool If is not the first part of the username. If true then "name" would match "name", "username", "wordsnamewords", etc
Результат List

RemoveUser() публичный Метод

Removes a given username from the database
public RemoveUser ( User user ) : void
user User User user
Результат void

SetUserGroup() публичный Метод

Sets the group for a given username
public SetUserGroup ( User user, string group ) : void
user User User user
group string string group
Результат void

SetUserPassword() публичный Метод

Sets the Hashed Password for a given username
public SetUserPassword ( User user, string password ) : void
user User User user
password string string password
Результат void

SetUserUUID() публичный Метод

Sets the UUID for a given username
public SetUserUUID ( User user, string uuid ) : void
user User User user
uuid string string uuid
Результат void

UpdateLogin() публичный Метод

Updates the last accessed time for a database user to the current time.
public UpdateLogin ( User user ) : void
user User The user object to modify.
Результат void

UserManager() публичный Метод

Creates a UserManager object. During instantiation, this method will verify the table structure against the format below.
public UserManager ( IDbConnection db ) : System
db IDbConnection The database to connect to.
Результат System