Vulnerability in EPiServer.Forms
I need to get alla forms in the system created by a specific user.
Right now I am using "IFormRepository" and getting all the forms with "GetFormsInfo()", this returns all the forms in the system but I need all forms created by a specific user.
Is there a way to do this?
The data returned by "GetFormsInfo()" does not contain any info about which user created the form.
Depending on what you wanted to do with the forms when you've found them, you could just treat them the same way as any other piece of content. Rather than using IFormRepository, you could perhaps get all instances of "FormContainerBlock" and filter them by creator (which is a property of IChangeTrackable) like this:
var contentModelUsage = ServiceLocator.Current.GetInstance<IContentModelUsage>();
var contentTypeRepo = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var templateType = contentTypeRepo.Load("FormContainerBlock");
var allForms = contentModelUsage.ListContentOfContentType(templateType).Select(x => contentLoader.Get<IContentData>(x.ContentLink, new CultureInfo(x.LanguageBranch)));
var bobsForms = allForms.Where(x => (x as IChangeTrackable).CreatedBy.Equals("Bob"));