trying to override bean id of UserCSVUploadPost class

cancel
Showing results for 
Search instead for 
Did you mean: 
monicakumari
Active Member II

trying to override bean id of UserCSVUploadPost class

Jump to solution

I have created a behaviour class NewUserEmail.java to auto generate an email with username and password while creating a new user mannualy and It is working fine. but this behaviour is automatically calls when I am creating multiple users by uploading CSV file. so users are getting two autogenerated mails - one is by default and another from that behaviour. now , I am trying to override the class UserCSVUploadPost so that I can remove the default behaviour of sending the mails while creating multiple users by uploading CSV file.

please guide me what to do, so that I can remove the default behaviour of sending the mails while uploading CSV file to create multiple users.

thanks in advance.

1 Solution

Accepted Solutions
yreg
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

To override Out Of The Box WebScripts you will probably need to place your <some>-context.xml file in the extensions directory not in the module directory, otherwise your bean will get overridden by alfresco's defaults.

9 Replies
yreg
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

To override Out Of The Box WebScripts you will probably need to place your <some>-context.xml file in the extensions directory not in the module directory, otherwise your bean will get overridden by alfresco's defaults.

monicakumari
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

yes. I have created custom-context.xml file inside extensions directory having content :

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
    <import resource="classpath*:alfresco/module/*/module-webscripts-context.xml" />
    
    <bean id="webscript.org.alfresco.repository.person.user-csv-upload.post"
        class="com.eisenvault.mailTest.CustomUserBulkUpload" parent="webscript">
        <property name="authenticationService" ref="AuthenticationService" />
        <property name="authorityService" ref="AuthorityService" />
        <property name="personService" ref="PersonService" />
        <property name="tenantService" ref="tenantService" />
        <property name="dictionaryService" ref="DictionaryService" />
        <property name="transactionHelper" ref="web.retryingTransactionHelper" />
    </bean>
    
</beans>

monicakumari
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

but its not working. I want to create multiple users by uploading CSV but dont want to send emails to the users. this is what I am trying to do. do you have any idea how to stop those mails.?

yreg
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

Try renaming the file to custom-web-context.xml, not sure if you should keep the import statement though.

monicakumari
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

thank you so much for your help. its working now with custom-web-context.xml. can you please help me to understand, why alfresco is working with this file name and how ?
and Is there any other way to override webscripts ?

thank you.

yreg
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

The main web application context loads in this order :

  1. the application context (which among others does load your module context)
  2. the web scripts application context (which loads the OOTB webscripts, overriding any definition you have in your module context)
  3. the enterprise web scripts application context (which loads the OOTB enterprise webscripts, overriding any definition you have in your module context, or in an OOTB community webscript)
  4. the custom-web-context.xml (the extension entry point for OOTB webscript)

You should then use a file from this classpath location "classpath*:alfresco/extension/custom-web-context.xml" to override OOTB webscripts.

krutik_jayswal
Senior Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

Extend/Override Users.js, which is located inside Share/Components/console.

Inside that file there is one function named as onUploadUsersClick

Inside this function replace below line

uploadURL: "api/people/upload.html",

With 

uploadURL: "api/people/upload.html?email=false",

 

Above change will solve your issue.

monicakumari
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

I want to hide the "password" and "verify password" fields on UI of creating new user. I think it must be some .html.ftl file. but I am not able to file the exact name of the file. do you have any idea about the file name ?

yreg
Active Member II

Re: trying to override bean id of UserCSVUploadPost class

Jump to solution

That's a different question, you should start a new thread for it.