Package | com.smartfoxserver.v2.requests |
Class | public class BanUserRequest |
Inheritance | BanUserRequest com.smartfoxserver.v2.requests.BaseRequest |
The current user must have administration or moderation privileges in order to be able to ban another user (see the User.privilegeId property). The user can be banned by name or by IP address (see the BanMode class). Also, the request allows sending a message to the banned user (to make clear the reason of the following disconnection) which is delivered by means of the moderatorMessage event.
Differently from the user being kicked (see the KickUserRequest request), a banned user won't be able to connect to the SmartFoxServer instance until the banishment expires (after 24 hours for client-side banning) or an administrator removes his name/IP address from the list of banned users by means of the SmartFoxServer 2X Administration Tool.
See also
Method | Defined By | ||
---|---|---|---|
BanUserRequest(userId:int, message:String = null, banMode:int = 1, delaySeconds:int = 5, durationHours:int = 24)
Creates a new BanUserRequest instance. | BanUserRequest |
BanUserRequest | () | Constructor |
public function BanUserRequest(userId:int, message:String = null, banMode:int = 1, delaySeconds:int = 5, durationHours:int = 24)
Creates a new BanUserRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
ParametersuserId:int — The id of the user to be banned.
| |
message:String (default = null ) — A custom message to be delivered to the user before banning him;
if null , the default message configured in the SmartFoxServer 2X Administration Tool is used.
| |
banMode:int (default = 1 ) — One of the ban modes defined in the BanMode class.
| |
delaySeconds:int (default = 5 ) — The number of seconds after which the user is banned after receiving the ban message.
| |
durationHours:int (default = 24 ) — The duration of the banishment, expressed in hours.
|
See also
private function someMethod():void { var userToBan:User = sfs.userManager.getUserByName("Jack"); sfs.send(new BanUserRequest(userToBan.id)); }