LPS-32718 Use remote service to display only document types the user has permission to view
LPS-32718 GroupId is not necessary because it's not used by select_file_entry_type
LPS-32718 Use the right value to notify the service if the folder is inheriting the document type restrictions or not
LPS-32718 If we don't inherit we just return the document types allowed in that folder. If we inherit we return the document types allowed in the folder we are inheriting from (even it if it's empty). We don't want to always return at least one document type, because if the folder is restricted to only one document type and the user cannot add that document type, he won't be able to add any document in that folder.
LPS-32718 When editing a existing document, user will be able to select amongst the document types supported by that folder, considering that either he has VIEW permission on the doc types or it's the basic document, or it's the current document type of the document.
LPS-32718 We need DISTINCT (as in countByC_G_N_D_S) because otherwise we will get duplicates when applying permission to the query
LPS-32718 There is an issue that prevents "Basic Document" because of the permissions. As "Basic Document" is an entity that doesn't have any permission (because it's a 'fake' entity) we need to extract it from the query affected by the permission and do a UNION ALL to make sure that it's always returned.
LPS-32718 We should display fileEntryTypes based on the results of DLFileEntryTypeServiceUtil.getFolderFileEntryTypes except when we are in a external repo that doesn't allow fileEntryTypes that we return Basic Document. The option to upload multiple documents will be displayed if the user has permission to upload a fileEntryType in that folder (upload multiple documents is not supported in external repos)