//get IP address of the client //from: http://stackoverflow.com/questions/13889463/get-client-ip-address-in-self-hosted-signalr-hub //delete message, need to control public void DeleteMessage(int messageId, int moduleId) { //todo: look to see if we should get user information from DNN somehow - CJH 3/5/2014 var section = (MachineKeySection)ConfigurationManager.GetSection("system.web/machineKey"); var validationKey = section.ValidationKey; var listOfRoles = (string)Clients.Caller.userroles; if (listOfRoles != null) { var roles = listOfRoles.Split(','); var pc = new PortalSecurity(); foreach (var r in roles) { var thisRole = pc.Decrypt(validationKey, r); //TODO: need to remove the hard coded administrators role here, make this a module setting - CJH 3/6/2014 if (thisRole == "Administrators" || thisRole == "SuperUser") { var mc = new MessageController(); mc.DeleteMessage(messageId, moduleId); //get the message and send it back so that we can remove it from the proper room var m = mc.GetMessage(messageId, moduleId); Clients.Group(m.RoomId.ToString()).deleteMessage(m); } } } }