C# Class TShockAPI.DB.UserManager

UserManager - Methods for dealing with database users and other user functionality within TShock.
Afficher le fichier Open project: NyxStudios/TShock Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
LoadUserFromResult ( User user, QueryResult result ) : User

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

Method Details

AddUser() public méthode

Adds a given username to the database
public AddUser ( User user ) : void
user User User user
Résultat void

GetUser() public méthode

Gets a user object by a user object.
public GetUser ( User user ) : User
user User The user object to search by.
Résultat User

GetUserByID() public méthode

Gets a user object by their user ID.
public GetUserByID ( int id ) : User
id int The user's ID.
Résultat User

GetUserByName() public méthode

Gets a user object by name.
public GetUserByName ( string name ) : User
name string The user's name.
Résultat User

GetUserID() public méthode

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.
Résultat int

GetUsers() public méthode

Gets all users from the database.
public GetUsers ( ) : List
Résultat List

GetUsersByName() public méthode

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
Résultat List

RemoveUser() public méthode

Removes a given username from the database
public RemoveUser ( User user ) : void
user User User user
Résultat void

SetUserGroup() public méthode

Sets the group for a given username
public SetUserGroup ( User user, string group ) : void
user User User user
group string string group
Résultat void

SetUserPassword() public méthode

Sets the Hashed Password for a given username
public SetUserPassword ( User user, string password ) : void
user User User user
password string string password
Résultat void

SetUserUUID() public méthode

Sets the UUID for a given username
public SetUserUUID ( User user, string uuid ) : void
user User User user
uuid string string uuid
Résultat void

UpdateLogin() public méthode

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.
Résultat void

UserManager() public méthode

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.
Résultat System