11-22-2019 03:44 AM
You should inspect folder
alfresco-share-parent\share\src\main\resources\alfresco\site-webscripts\org\alfresco\components\workflow
there you'll see files
workflow-list.get.config.xml, task-list.get.config.xml - these are config files that turn filter values to a request parameters.
Also in the abovementioned folder you can find configuration for filters in /filter subfolder. There is a set of files for each filter section. Basically they are presentation web-scripts.
Each filter section has it own web-script(with its config, template and controller). So, in the <>.get.config.xml you place youe new filter and in the JS controller you can perform a validation that user is admin like this:
<import resource="classpath:alfresco/site-webscripts/org/alfresco/components/workflow/filter/filter.lib.js">
model.filters = [];
var filters = getFilters();
for each(var filter in filters) {
if (filter.data == "all") {
if (user.isAdmin) {
model.filters.push(filter);
}
} else {
model.filters.push(filter);
}
}
And for comparison OOB implementation of JS controller for filters:
<import resource="classpath:alfresco/site-webscripts/org/alfresco/components/workflow/filter/filter.lib.js">
model.filters = getFilters();
user here is one of the Surf root JavaScript objects.
In summary, on Share side I customized the following files:
Added new row for matching new filter value to request parameter:
site-webscripts/org/alfresco/components/workflow/task-list.get.config.xml
site-webscripts/org/alfresco/components/workflow/workflow-list.get.config.xml
Described new filter in config, modified the controller to include new filter only for admin user, added filter label in resource bundle:
site-webscripts/org/alfresco/components/workflow/filter/all.get.config.xml
site-webscripts/org/alfresco/components/workflow/filter/all.get.js
site-webscripts/org/alfresco/components/workflow/filter/all.get.properties
That was the way I implemented it.
Explore our Alfresco products with the links below. Use labels to filter content by product module.