public DecisionMessage GetMeetingDecisions(Guid meetingId, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_decisionRepository.GetDecisionCollection(meetingId, user.InstanceId, instanceConnectionString)); }
public MessageBase UpdateText(Guid agendaId, string text, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_minutzAgendaRepository.UpdateText(agendaId, text, user.InstanceId, instanceConnectionString)); }
public (bool condition, string message, IEnumerable <MinutzAction> data) GetMinutzActions (string referenceId, AuthRestModel user) { if (string.IsNullOrEmpty(referenceId)) { throw new ArgumentNullException(nameof(referenceId), "Please provide a valid reference id."); } var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); var masterConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password); if (referenceId != user.InstanceId) { var actions = _actionRepository.GetMeetingActions(Guid.Parse(referenceId), user.InstanceId, instanceConnectionString); return(true, "", actions); } // check if referenceId is a meetingViewModel id // if id is a meetingViewModel id then check if meetingViewModel has actions for user // if meetingViewModel is not a meetingViewModel id [referenceId] then use it as the user Id and check for actions - these become tasks return(true, "", new List <MinutzAction>()); }
public ActionMessage Actions(AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_userActionsRepository.Actions(user.Email, user.InstanceId, instanceConnectionString)); }
public MessageBase DeleteDecision(Guid decisionId, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_decisionRepository.DeleteDecision(decisionId, user.InstanceId, instanceConnectionString)); }
public MeetingMessage Meeting(AuthRestModel user, Guid meetingId) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_userMeetingsRepository.Meeting(meetingId, user.InstanceId, instanceConnectionString)); }
public MessageBase Update(string meetingId, string title, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_minutzTitleRepository.Update(meetingId, title, user.InstanceId, instanceConnectionString)); }
//[Test] public void InviteUser_Given_Attendee_And_Meeting_IEmailValidationService_IsCalled() { var availabilityRepository = Substitute.For <IMinutzAvailabilityRepository>(); var attendeeRepository = Substitute.For <IMinutzAttendeeRepository>(); var userRepository = Substitute.For <IUserRepository>(); var applicationSetting = Substitute.For <IApplicationSetting>(); var restAuthUser = new AuthRestModel { InstanceId = Guid.NewGuid().ToString(), Email = "*****@*****.**" }; Mock <IEmailValidationService> _emailValidationService = new Mock <IEmailValidationService>(); _emailValidationService.Setup(x => x.Valid(It.IsAny <string>()).Returns(true)); var attendee = new MeetingAttendee { Email = "*****@*****.**" }; var meeting = new Meeting { Name = "Foo", Id = Guid.NewGuid() }; var service = new InvitationService(_emailValidationService.Object, availabilityRepository, attendeeRepository, userRepository, applicationSetting); service.InviteUser(restAuthUser, attendee, meeting); _emailValidationService.Verify(x => x.Valid("*****@*****.**"), Times.AtLeastOnce); }
public MeetingMessage UpdateMeeting(Minutz.Models.Entities.Meeting meeting, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_userManageMeetingRepository.Update(meeting, user.InstanceId, instanceConnectionString)); }
public static AuthRestModel ToRest (this ClaimsPrincipal user) { var email = user.Claims.ToList().SingleOrDefault(i => i.Type == "access_token"); if (email == null) { throw new Exception("The user Identity does not contain a sub [email]."); } var instanceId = user.Claims.ToList().SingleOrDefault(i => i.Type == "instanceId"); if (instanceId == null) { throw new Exception("The user Identity does not contain instanceId."); } var role = user.Claims.ToList().SingleOrDefault(i => i.Type == "roles"); if (role == null) { throw new Exception("The user Identity does not contain role."); } var name = user.Claims.ToList().SingleOrDefault(i => i.Type == "nickname"); if (name == null) { throw new Exception("The user Identity does not contain name."); } var picture = user.Claims.ToList().SingleOrDefault(i => i.Type == "picture"); if (picture == null) { throw new Exception("The user Identity does not contain picture."); } var exp = user.Claims.ToList().SingleOrDefault(i => i.Type == "exp"); if (exp == null) { throw new Exception("The user Identity does not contain exp."); } var accessToken = user.Claims.ToList().SingleOrDefault(i => i.Type == "access_token"); if (accessToken == null) { throw new Exception("The user Identity does not contain exp."); } var result = new AuthRestModel { Email = email.Value, Name = name.Value, Picture = picture.Value, Nickname = name.Value, Role = role.Value, InstanceId = instanceId.Value, TokenExpire = exp.Value, Sub = email.Value, AccessToken = accessToken.Value }; return(result); }
public AgendaMessage GetMeetingAgendaCollection(Guid meetingId, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); var data = _minutzAgendaRepository.GetMeetingAgendaCollection(meetingId, user.InstanceId, instanceConnectionString); if (data.Condition) { if (data.AgendaCollection.Any()) { var updated = new List <MeetingAgenda>(); foreach (var agenda in data.AgendaCollection) { if (agenda.Order == 0) { agenda.Order = updated.Count; } updated.Add(agenda); } data.AgendaCollection = updated; data.AgendaCollection = data.AgendaCollection.OrderBy(i => i.Order).ToList(); } } return(new AgendaMessage { Condition = data.Condition, Message = data.Message, AgendaCollection = data.AgendaCollection }); }
public NoteMessage UpdateNote(Guid meetingId, MeetingNote note, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_noteRepository.UpdateNote(meetingId, note, user.InstanceId, instanceConnectionString)); }
public (bool condition, string message) StartFullVersion(AuthRestModel user) { user.Role = "User"; var masterConnectionString = _applicationSetting.CreateConnectionString( _applicationSetting.Server, "master", _applicationSetting.Username, _applicationSetting.Password); var userConnectionString = _applicationSetting.CreateConnectionString( _applicationSetting.Server, _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password); try { var schemaCreate = _userRepository.CreateNewSchema( user, userConnectionString, masterConnectionString); _applicationSetupRepository.CreateSchemaTables(_applicationSetting.Schema, schemaCreate, _applicationSetting.CreateConnectionString( _applicationSetting.Server, _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password)); } catch (Exception ex) { return(false, ex.Message); } return(true, "successfull"); }
public void InviteUser_Given_MeetingAttendee_With_Email_ReturnTrue() { var availabilityRepository = Substitute.For <IMinutzAvailabilityRepository>(); var attendeeRepository = Substitute.For <IMinutzAttendeeRepository>(); var userRepository = Substitute.For <IUserRepository>(); var applicationSetting = Substitute.For <IApplicationSetting>(); var restAuthUser = new AuthRestModel { InstanceId = Guid.NewGuid().ToString(), Email = "*****@*****.**" }; userRepository.CheckIfNewUser("foo", "foo", "foo", "foo", "foo").ReturnsForAnyArgs(new MessageBase { Condition = true, Code = 4 }); var attendee = new MeetingAttendee { Email = "*****@*****.**" }; var meeting = new Meeting { Name = "Foo", Id = Guid.NewGuid() }; var service = new InvitationService(_emailValidationService, availabilityRepository, attendeeRepository, userRepository, applicationSetting); var result = service.InviteUser(restAuthUser, attendee, meeting); Assert.IsTrue(result.Condition); }
public MessageBase Update(Guid meetingId, string fileUrl, int order, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_meetingAttachmentRepository.Update(meetingId, fileUrl, order, user.InstanceId, instanceConnectionString)); }
public AttachmentMessage Get(Guid meetingId, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_meetingAttachmentRepository.Get(meetingId, user.InstanceId, instanceConnectionString)); }
public MessageBase DeleteAttendee(Guid meetingId, string attendeeEmail, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_minutzAttendeeRepository.DeleteAttendee(meetingId, attendeeEmail, user.InstanceId, instanceConnectionString)); }
public MeetingMessage UpdatePurpose(Guid meetingId, string purpose, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_meetingObjectivePurposeRepository.UpdatePurpose(meetingId, purpose, user.InstanceId, instanceConnectionString)); }
public static AuthRestModel UpdateTokenInfo (this AuthRestModel model, UserResponseModel tokenResponseModel) { model.IdToken = tokenResponseModel.id_token; model.AccessToken = tokenResponseModel.access_token; model.TokenExpire = tokenResponseModel.expires_in; return(model); }
public MessageBase UpdateMeetingStatus(Guid meetingId, string status, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_meetingStatusRepository.UpdateMeetingStatus(meetingId, status, user.InstanceId, instanceConnectionString)); }
public MessageBase UpdateActionOrder(Guid actionId, int order, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_minutzActionRepository.UpdateActionOrder(actionId, order, user.InstanceId, instanceConnectionString)); }
public MessageBase UpdateActionAssignedAttendee(Guid actionId, string email, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_minutzActionRepository.UpdateActionAssignedAttendee(actionId, email, user.InstanceId, instanceConnectionString)); }
public AttendeeMessage AddAttendee(Guid meetingId, MeetingAttendee attendee, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); return(_minutzAttendeeRepository.AddAttendee(meetingId, attendee, user.InstanceId, instanceConnectionString)); }
/// <summary> /// Get the attendees that can be used for a meeting /// </summary> /// <param name="user">Current logged in user</param> /// <returns>Collection of people that can be used for a meeting</returns> public AttendeeMessage GetAvailableAttendees(AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); var masterConnectionString = _applicationSetting.CreateConnectionString(); return(_minutzAvailabilityRepository.GetAvailableAttendees(user.InstanceId, instanceConnectionString, masterConnectionString)); }
public (bool condition, string message, byte[] file) CreateMinutes (Meeting meetingItem, IEnumerable <MeetingAttendee> attendeescollection, IEnumerable <MeetingAgenda> agendaCollection, IEnumerable <MeetingNote> notecollection, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); var masterConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password); var agenditems = new List <dynamic>(); var noteItems = new List <dynamic>(); var people = new List <dynamic>(); foreach (var agenda in agendaCollection) { agenditems.Add(new { agendaHeading = agenda.AgendaHeading, agendaText = agenda.AgendaText }); } foreach (var note in notecollection) { noteItems.Add(new { agendaHeading = note.NoteText }); } foreach (var attendee in attendeescollection) { noteItems.Add(new { name = attendee.Name, role = attendee.Role }); } var meeting = new { name = meetingItem.Name, date = meetingItem.Date, location = meetingItem.Location, time = meetingItem.Time, purpose = meetingItem.Purpose, outcome = meetingItem.Outcome, agenda = agenditems, attendees = people, notes = noteItems }; var jsReportResult = _reportRepository.CreateMinutesReport(meeting); if (jsReportResult.condition) { var createMinutesResult = _meetingRepository.CreateUpdateMeetingMinutes (user.InstanceId, instanceConnectionString, meetingItem.Id.ToString(), jsReportResult.file); if (!createMinutesResult.condition) { _logService.Log(LogLevel.Error, $"JsReportService - Line:73 - _meetingRepository.CreateUpdateMeetingMinutes{ createMinutesResult.message}"); } } return(jsReportResult); }
public (bool condition, string message, MinutzAction value) UpdateMinutzAction (string referenceId, MinutzAction action, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); var result = _actionRepository.Update(action, user.InstanceId, instanceConnectionString); return(result, result ? "Success": "Failed", action); }
public (bool condition, string message) DeleteMinutzAction (string referenceId, string actionId, AuthRestModel user) { var instanceConnectionString = _applicationSetting.CreateConnectionString(_applicationSetting.Server, _applicationSetting.Catalogue, user.InstanceId, _applicationSetting.GetInstancePassword(user.InstanceId)); var result = _actionRepository.Delete(Guid.Parse(actionId), user.InstanceId, instanceConnectionString); return(true, ""); }
public (bool condition, string message) ResetAcccount(AuthRestModel user) { var connectionString = _applicationSetting.CreateConnectionString( _applicationSetting.Server, _applicationSetting.Catalogue, _applicationSetting.Username, _applicationSetting.Password); return(this._userRepository.Reset(connectionString, user.InstanceId, user.Name)); }
public static AuthRestModel UpdateFromInstance (this AuthRestModel model, Person person, Instance instance) { model.InstanceId = instance.Username; model.Company = instance.Company; model.Related = person.Related; model.Role = person.Role; model.FirstName = person.FirstName; model.LastName = person.LastName; model.Email = person.Email; return(model); }
public (bool condition, string message, AuthRestModel value) CreateUser (string name, string email, string password, string role, string instanceId) { if (string.IsNullOrEmpty(email)) { return(false, "Please provide as username", null); } if (string.IsNullOrEmpty(password)) { return(false, "Please provide as password", null); } if (string.IsNullOrEmpty(role)) { return(false, "Please provide as role", null); } if (_customPasswordValidator.CheckStrength(password) == PasswordScore.Blank) { return(false, "Please provide a valid password", null); } if (_customPasswordValidator.CheckStrength(password) == PasswordScore.Weak) { return(false, "Please provide a stronger password", null); } var userResult = _minutzUserManager.Ensure(_userManager, email, password); if (!userResult.Condition) { return(userResult.Condition, userResult.message, null); } _signInManager.SignInAsync(userResult.user, false).ConfigureAwait(false); var rolesResult = _minutzRoleManager.Ensure(_userManager, email, role); if (!rolesResult.Condition) { return(rolesResult.Condition, rolesResult.Message, null); } var resultModel = new AuthRestModel { Sub = email, IsVerified = false, Email = email, Nickname = name, InstanceId = $"A_{rolesResult.user.Id}", Role = rolesResult.roles.FirstOrDefault() }; return(true, "Success", resultModel); }