• Welcome to KonaKart Community Forum. Please login or sign up.
 

change group to a user runtime

Started by cosimo, May 16, 2013, 10:29:45 am

Previous topic - Next topic

cosimo

Hello I want to know if it is possible to change the group of a user dynamically at runtime.
For example, a user logs in and after an operation changes group, after another operation returns to its parent group.

trevor

Yes, you can do that either through the admin app or the admin APIs.

When you use the admin app, it also prompts you to allow you to send a template based email for which group you are being transferred to. e.g. You may sign up as a wholesale customer but be temporarily be put into a retail customer group until you are approved. When you are approved, the administrator changes your group and sends out an email to inform you of the change.

cosimo

I was thinking to a more rapid action to change the group by the call of an API, without having to go through the administration panels.
The user logged, in the same session, can go from one group to another (without having to log out and log in)?

trevor

Within the application you can use the editCustomer() API call:

    /**
     * The Customer object will replace the existing customer object in the database.
     * <code>cust</code> has to be the same customer logged in with a valid <code>sessionId</code>.
     * Only non null attributes or integers not equal to -1 will be used (i.e. set an integer field
     * to -1 if you do not want to change it).
     * <p>
     * The attributes from the Customer object that are used are :
     * <ul>
     * <li>gender</li>
     * <li>firstName</li>
     * <li>lastName</li>
     * <li>birthDate</li>
     * <li>emailAddr</li>
     * <li>faxNumber</li>
     * <li>telephoneNumber</li>
     * <li>telephoneNumber1</li>
     * <li>locale</li>
     * <li>newsletter</li>
     * <li>password</li>
     * <li>customerType</li>
     * <li>customerGroup</li>
     * <li>custom1</li>
     * <li>custom2</li>
     * <li>custom3</li>
     * <li>custom4</li>
     * <li>custom5</li>
     * <li>dateLastModified</li>
     * <li>globalProductNotifications</li>
     * </ul>
     *
     * @param sessionId
     *            The session id of the logged in user
     * @param cust
     *            The customer object to edit
     * @throws KKException
     */
    public void editCustomer(String sessionId, CustomerIf cust) throws KKException;