We can inject the repository service dependencies using 2 methods. One method is a lower case e.g. “contentService” bean ref and other method is upper case e.g. “ContentService” bean ref, similarly we can use "nodeService" or "NodeService".
To use a service in your custom implementation, you usually use a spring config (spring context) file to inject service bean dependencies. So in your spring context file, for your class for example “com.abhinav.CustomAction”, you can either use "nodeService" [lower-case] or "NodeService" [upper-case].
The best practice is that we should always use services with upper case “NodeService”, “ContentService”, “FileFolderService” etc. because this lower case “nodeService”, ”contentService” etc. bypasses security check, audit and transaction checks.
Technically Alfresco uses AOP (Aspect-Oriented Programming) to expose services as “AOP proxies”.
To prove that, let’s go through publicly exposed services and some core services such as nodeService and contentService:
Notice that, the property ‘interceptorNames’ which has list of interceptors, which force the execution of transaction check (ContentService_transaction), audit (AuditMethodInterceptor) and security check (ContentService_security) etc.
So when you directly call the “contentService” (lower case), all these check are bypassed.
This can leads to security issue because alfresco will not evaluate the security before running the corresponding service operation in this case. So, it is best practice to use upper case services always.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.