private static Dictionary <Type, List <IPublishControlled> > GetDataRequiringAction(IEnumerable <Type> dataTypesToQuery) { Dictionary <Type, List <IPublishControlled> > unpublishedData = new Dictionary <Type, List <IPublishControlled> >(); UserToken userToken = UserValidationFacade.GetUserToken(); List <UserPermissionDefinition> userPermissionDefinitions = PermissionTypeFacade.GetUserPermissionDefinitions(userToken.Username).ToList(); List <UserGroupPermissionDefinition> userGroupPermissionDefinition = PermissionTypeFacade.GetUserGroupPermissionDefinitions(userToken.Username).ToList(); foreach (Type t in dataTypesToQuery) { if (typeof(IPublishControlled).IsAssignableFrom(t)) { Type dataLoaderType = typeof(DataLoader <>).MakeGenericType(new Type[] { t }); IDataLoader dataLoader = (IDataLoader)Activator.CreateInstance(dataLoaderType); List <IPublishControlled> actionRequiredData = dataLoader.GetUnPublishedData().ToList(); foreach (IPublishControlled dataItem in actionRequiredData.ToList()) { DataEntityToken entityToken = dataItem.GetDataEntityToken(); var permissions = PermissionTypeFacade.GetCurrentPermissionTypes(userToken, entityToken, userPermissionDefinitions, userGroupPermissionDefinition).ToList(); if (permissions.Contains(PermissionType.Read) == false) { actionRequiredData.Remove(dataItem); } } if (actionRequiredData.Any() == true) { unpublishedData.Add(t, actionRequiredData); } } } return(unpublishedData); }