ChatUserHelper Class |
Namespace: CMS.Chat
public static class ChatUserHelper
The ChatUserHelper type exposes the following members.
Name | Description | |
---|---|---|
GetChatUserFromCMSUser |
Gets chat user assigned to CURRENT CMSUser. If chat user does not exist, it is created with nickname set to FullName of CMSUser.
| |
GetChatUserFromCMSUser(UserInfo) |
Gets chat user assigned to passed CMSUser. If chat user does not exist, it is created with nickname set to FullName of CMSUser.
| |
HasChatUserPermission |
Checks if chat user has permission.
| |
ChangeChatUserNickname |
Changes nickname of passed chatUser.
| |
CheckAdminRoomRights(Int32) |
Check if current user has admin rights to room.
User have admin rights if one of the following conditions is valid:
- he is global admin
- he has permission ChatPermissionEnum.ManageRooms
- he is creator of this room
- he is associated as admin to this room in table ChatRoomAdmin
- room is support (ChatRoomIsSupport = true) and user has permission ChatPermissionEnum.EnterSupport
| |
CheckAdminRoomRights(Int32, ChatUserInfo) |
Check if user has admin rights to room.
User have admin rights if one of the following conditions is valid:
- he is global admin
- he has permission ChatPermissionEnum.ManageRooms
- he is creator of this room
- he is associated as admin to this room in table ChatRoomAdmin
- room is support (ChatRoomIsSupport = true) and user has permission ChatPermissionEnum.EnterSupport
| |
CheckJoinRoomRights |
Checks if current chat user has Join rights to the specified room.
- user can't be kicked
- if room is public, user always has Join rights
- if he is admin, he also has join rights
- supporters always have Join rights in support rooms
| |
IsNicknameAvailable(String) |
Returns true if nickname is available. Otherwise false. Takes into account ChatHelper.ForceAnonymUniqueNicknamesSetting.
| |
IsNicknameAvailable(String, Boolean) |
Returns true if nickname is available. Otherwise false.
Current user is not counted.
| |
RegisterAndLoginChatUser |
Registers guest chat user. His nickame is generated automatically. If CMS User is logged in, guest is not registered and this CMS User is logged in.
| |
RegisterAndLoginChatUser(Boolean) |
Registers guest chat user. His nickame is generated automatically. If CMS User is logged in, guest is not registered and this CMS User is logged in.
| |
RegisterAndLoginChatUser(String) |
If CMS User is currently logged in, it logs him into chat. Parameter nickname is ignored in that case.
If CMS User is not logged in, user is registered as anonymous chat user with nickname set to parameter nickname.
Does nothing if chat user is currently logged in.
| |
RegisterAndLoginChatUser(String, Boolean) |
If CMS User is currently logged in, it logs him into chat. Parameter nickname is ignored in that case.
If CMS User is not logged in, user is registered as anonymous chat user with nickname set to parameter nickname.
Does nothing if chat user is currently logged in.
| |
RegisterAnonymousChatUser |
Registers anonym chat user with specified nickname.
| |
VerifyChatUserHasJoinRoomRights |
Verifies that currently logged in chat user has join rights for a room.
Throws exception with AccessDenied (or Kicked) type and message set to the cause of the denial in case of failure and does nothing in case of success.
Join rights:
- user can't be kicked
- if room is public, user always has Join rights
- if he is admin, he also has join rights
- supporters always have Join rights in support rooms
| |
VerifyNicknameIsValid |
Checks if nickname is valid. Nickname is also trimmed.
Nickname cannot be empty
Nickname cannot exceed 50 characters
User can't manually change his nickname to guest nickname
Throws exception if not valid
|