/// <summary> /// Fetches all feedback Threads /// </summary> /// <param name="feedbackId">feedbackId</param> /// <param name="currentUser">current user </param> public Feedback GetFeedbackWithThreads(int feedbackId, User currentUser) { int feedbackForUserId = FeedbackDataAccesor.GetTraineebyFeedbackId(feedbackId); if (!(currentUser.IsAdministrator || currentUser.IsManager || currentUser.IsTrainer || currentUser.UserId == feedbackForUserId)) { return(null); } return(FeedbackDataAccesor.GetFeedbackWithThreads(feedbackId)); }
/// <summary> /// authorize Current user for team's Feedback /// </summary> /// <param name="feedbackId">feedback Id</param> /// <param name="currentUser">Current User</param> /// <returns>Success flag</returns> public bool AuthorizeCurrentUserForFeedback(int feedbackId, User currentUser) { return((currentUser.IsAdministrator && !currentUser.TeamId.HasValue) || FeedbackDataAccesor.GetFeedbackWithThreads(feedbackId).AddedBy.UserId == Constants.AppBotUserId || FeedbackDataAccesor.GetFeedbackWithThreads(feedbackId).AddedBy.TeamId == currentUser.TeamId); }