Example #1
0
        /// <summary>
        /// Ryan Taylor
        /// Created: 03/21/16
        /// Get all groups the associated user is affiliated with
        /// </summary>
        /// <param name="userID">ID of user used for search, passed from Access Token</param>
        /// <returns>List of Groups the user belongs to</returns>
        public List <Group> GetGroupsForUser(int userID)
        {
            List <Group> groups = null;

            try
            {
                groups = GroupAccessor.RetrieveUsersGroups(userID);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return(groups);
        }
Example #2
0
        /// <summary>
        /// Really bad method, just using duct tape.
        ///
        /// Created by: Trent Cullinan 05/05/2016
        /// </summary>
        /// <param name="groupId"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public bool IsGroupMember(string groupName, int userId)
        {
            bool flag = false;

            List <Group> groups = null;

            try
            {
                groups = GroupAccessor.RetrieveUsersGroups(userId);
            }
            catch (Exception) { }

            if (null != groups)
            {
                flag = 0 < groups.Where(g => g.Name == groupName).Count();
            }

            return(flag);
        }