Package in.partake.controller.action.event

Source Code of in.partake.controller.action.event.EventPrivacyEditAction

package in.partake.controller.action.event;

import play.mvc.Result;
import in.partake.base.PartakeException;
import in.partake.controller.base.permission.EventEditPermission;
import in.partake.model.UserEx;
import in.partake.model.dao.DAOException;
import in.partake.resource.UserErrorCode;

public class EventPrivacyEditAction extends AbstractEventEditAction {
    private String eventId;

    public static Result get(String eventId) throws DAOException, PartakeException {
        EventPrivacyEditAction action = new EventPrivacyEditAction();
        action.eventId = eventId;
        return action.execute();
    }

    @Override
    protected Result doExecute() throws DAOException, PartakeException {
        UserEx user = ensureLogin();
        checkIdParameterIsValid(eventId, UserErrorCode.INVALID_NOTFOUND, UserErrorCode.INVALID_NOTFOUND);

        event = new EventEditTransaction(eventId).execute();
        if (event == null)
            return renderNotFound();

        if (!EventEditPermission.check(event, user))
            return renderForbidden(UserErrorCode.FORBIDDEN_EVENT_EDIT);

        return render(views.html.events.edit_privacy.render(context(), event));
    }
}

TOP

Related Classes of in.partake.controller.action.event.EventPrivacyEditAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.