C# Class wmib.Security

Datei anzeigen Open project: benapetr/wikimedia-bot Class Usage Examples

Public Properties

Property Type Description
Roles Role>.Dictionary
Users List

Public Methods

Method Description
AddUser ( string level, string user ) : bool

Add

Auth ( string User, string Password ) : SystemUser

Verify the users credentials and if they are correct, returns a user instance

DeleteUser ( SystemUser origin, string user ) : void

Delete user

Dump ( ) : string
EscapeUser ( string name ) : string

Normalize user

GetGlobalUser ( string user ) : SystemUser

Gets the global user. Work just as GetUser, but only for global records

GetLevel ( libirc user ) : int

Return a level of role that this user posses

GetLevelOfRole ( string role ) : int
GetNameOfRole ( Security role ) : string
GetUser ( libirc user ) : SystemUser
GetUser ( string user ) : SystemUser

Return user object from a name Search all global and local records for matching regex, if multiple matches are existing the one with highest privileges is returned.

Global ( ) : void

Load a global list

Init ( ) : void

Load all roles

InsertUser ( XmlNode node ) : void
IsApproved ( libirc user, string command ) : bool

Check if user is approved to do operation requested

IsApproved ( string User, string Host, string privilege ) : bool

Check if user is approved to do operation requested

IsGloballyApproved ( SystemUser user, string permission ) : bool
IsGloballyApproved ( libirc user, string permission ) : bool
IsKnown ( libirc user ) : bool
IsKnown ( string User, string Host ) : bool
IsRole ( string name ) : bool
ListAll ( ) : string

List all users to a channel

Save ( ) : bool

Save

Security ( Channel channel ) : System

Private Methods

Method Description
GlobalChanged ( object sender, EventArgs e ) : void

This is called when the file is changed

GlobalLoad ( ) : void

Load all global users of bot

HasPrivilege ( string privilege, string role ) : bool

Method Details

AddUser() public method

Add
public AddUser ( string level, string user ) : bool
level string Level
user string Regex
return bool

Auth() public static method

Verify the users credentials and if they are correct, returns a user instance
public static Auth ( string User, string Password ) : SystemUser
User string Username
Password string Password
return SystemUser

DeleteUser() public method

Delete user
public DeleteUser ( SystemUser origin, string user ) : void
origin SystemUser
user string Regex
return void

Dump() public static method

public static Dump ( ) : string
return string

EscapeUser() public static method

Normalize user
public static EscapeUser ( string name ) : string
name string
return string

GetGlobalUser() public static method

Gets the global user. Work just as GetUser, but only for global records
public static GetGlobalUser ( string user ) : SystemUser
user string /// Identification string against which the user regexes are tested, this is usually a string /// in format of 'nick!ident@hostname' ///
return SystemUser

GetLevel() public method

Return a level of role that this user posses
public GetLevel ( libirc user ) : int
user libirc
return int

GetLevelOfRole() public static method

public static GetLevelOfRole ( string role ) : int
role string
return int

GetNameOfRole() public static method

public static GetNameOfRole ( Security role ) : string
role Security
return string

GetUser() public method

public GetUser ( libirc user ) : SystemUser
user libirc
return SystemUser

GetUser() public method

Return user object from a name Search all global and local records for matching regex, if multiple matches are existing the one with highest privileges is returned.
public GetUser ( string user ) : SystemUser
user string /// Identification string against which the user regexes are tested, this is usually a string /// in format of nick!ident@hostname (typical for IRC protocol) ///
return SystemUser

Global() public static method

Load a global list
public static Global ( ) : void
return void

Init() public static method

Load all roles
public static Init ( ) : void
return void

InsertUser() public method

public InsertUser ( XmlNode node ) : void
node System.Xml.XmlNode
return void

IsApproved() public method

Check if user is approved to do operation requested
public IsApproved ( libirc user, string command ) : bool
user libirc
command string
return bool

IsApproved() public method

Check if user is approved to do operation requested
public IsApproved ( string User, string Host, string privilege ) : bool
User string Username
Host string Hostname
privilege string Approved for specified object / request
return bool

IsGloballyApproved() public static method

public static IsGloballyApproved ( SystemUser user, string permission ) : bool
user SystemUser
permission string
return bool

IsGloballyApproved() public static method

public static IsGloballyApproved ( libirc user, string permission ) : bool
user libirc
permission string
return bool

IsKnown() public method

public IsKnown ( libirc user ) : bool
user libirc
return bool

IsKnown() public method

public IsKnown ( string User, string Host ) : bool
User string
Host string
return bool

IsRole() public static method

public static IsRole ( string name ) : bool
name string
return bool

ListAll() public method

List all users to a channel
public ListAll ( ) : string
return string

Save() public method

Save
public Save ( ) : bool
return bool

Security() public method

public Security ( Channel channel ) : System
channel Channel
return System

Property Details

Roles public_oe static_oe property

public static Dictionary Roles
return Role>.Dictionary

Users public_oe property

List of all users in a channel
public List Users
return List