cancel
Showing results for 
Search instead for 
Did you mean: 

Download user details from storefront.

krishn_signet
Participant
0 Kudos

Let say as a admin user od my org, I want to download all the user who are registered to site. How can I do that? I want all user to be available at manage user page where user can click on download report button which will download details in excel format.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member618655
Active Participant
0 Kudos

We introduced a enum called userType in our userModel, as soon as the user registers we update the userType to 'REGISTERED', otherwise the user is 'GUEST'.

Once this is done, we created a cronjob and in the cronjob we had the following logic. // fetch all users where type is registered. query = select {pk} from {User} where {userType} = ?userType

You get all the users, now we saved these users in an excel and placed it under {HYBRIS_DATA_FOLDER}\users\

name of your excel file should be unique and random otherwise it is prone to disk drive attacks. See below link for providing file security

https://tika.apache.org/

Now, we created a controller called ManageUserController and when someone hit the fetchUsers function of this controller, we returned the saved list.

Make sure when you create ManageUserController, it is only accessible to your admin server and not your customer facing server, you can do this by apache configuration.

VinayKumarS
Active Contributor
0 Kudos

There is no out of the box functionality for this requirement. if you want this on your storefront then you need to write your own customization.

Otherwise use a report cockpit and generate the report by writing the code in jrxml to execute it in report cockpit.

krishn_signet
Participant
0 Kudos

Do Hybris provides atleast API for this or not?

Marko_salonen
Contributor
0 Kudos

You could use the OCC for this https://help.hybris.com/1808/hcd/8c19ab00866910148f87bf32d4a60d38.html There you have calls that be used to search users. It might be so that you need to add a customized call depending if you want to have a list of all users.