Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.User


    protected void doExecute() throws Exception {
        super.doExecute();

        String recipientId = getRecipient();
        User sender = getSession().getIdentity().getUser();
        User recipient;

        try {
            UserManager userManager = sender.getAccreditableManager().getUserManager();
            recipient = userManager.getUser(recipientId);
            Assert.notNull("user " + recipientId, recipient);
View Full Code Here


        StringBuffer stringBuf = new StringBuffer("event:").append(version.getEvent());
        stringBuf.append(" state:").append(version.getState());

        Identity identity = getSession().getIdentity();
        User user = identity.getUser();
        if (user != null) {
            stringBuf.append(" user:").append(identity.getUser().getId());
        }
        stringBuf.append(" machine:").append(identity.getMachine().getIp());
View Full Code Here

        Session session = new SessionImpl(null, true, getManager(), getLogger());
        getRequest().setAttribute(Session.class.getName(), session);
       
        DefaultAccessController ac = getAccessController(session, pubId);
        AccreditableManager acMgr = ac.getAccreditableManager();
        User user = acMgr.getUserManager().getUser(userId);

        if (user == null) {
            throw new AccessControlException("The user [" + userId + "] does not exist!");
        }

        ac.setupIdentity(getRequest());

        org.apache.cocoon.environment.Session cocoonSession = getRequest().getSession();
        Identity identity = (Identity) cocoonSession.getAttribute(Identity.class.getName());

        if (!identity.contains(user)) {
            User oldUser = identity.getUser();
            if (oldUser != null) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Removing user [" + oldUser + "] from identity.");
                }
                identity.removeIdentifiable(oldUser);
View Full Code Here

            log.debug("    No notification parameters found.");
        } else {
            log.debug("    Initializing notification");

            Identity identity = Identity.getIdentity(request.getSession());
            User user = identity.getUser();
            String eMail = user.getEmail();
            notificationMap.put(Notifier.PARAMETER_FROM, eMail);
            log.debug("    Setting from address [" + Notifier.PARAMETER_FROM + "] = [" + eMail
                    + "]");

            String toKey = NamespaceMap.getFullName(Notifier.PREFIX, Notifier.PARAMETER_TO);
View Full Code Here

     * @param identity An identity.
     */
    public static void setIdentity(NamespaceMap parameters, Identity identity) {

        String userId = "";
        User user = identity.getUser();
        if (user != null) {
            userId = user.getId();
        }
        parameters.put(USER_ID, userId);

        String machineIp = "";
        Machine machine = identity.getMachine();
View Full Code Here

       
        // obtain submitted version
        Version version = versions[versions.length - 2];
       
        String userId = version.getUserId();
        User user = PolicyUtil.getUser(this.manager, authoringDocument.getCanonicalWebappURL(),
                userId, getLogger());

        Identifiable[] recipients = { user };

        Document liveVersion = authoringDocument.getAreaVersion(Publication.LIVE_AREA);
        String url;

        url = getWebUrl(liveVersion);
        User sender = getSession().getIdentity().getUser();
       
        Text[] subjectParams = { new Text(getEvent(), true) };
        Text[] params = { new Text(url, false) };
        Text subject = new Text(MESSAGE_SUBJECT, subjectParams);
        Text body = new Text(MESSAGE_DOCUMENT_PUBLISHED, params);
View Full Code Here

            Request request = ContextHelper.getRequest(this.context);
            Session session = request.getSession(false);
            if (session != null) {
                Identity identity = (Identity) session.getAttribute(Identity.class.getName());
                if (identity != null) {
                    User user = identity.getUser();
                    if (user != null) {
                        userId = user.getId();
                        objects.put(UsecaseCronJob.USER_ID, userId);
                    }
                    Machine machine = identity.getMachine();
                    if (machine != null) {
                        objects.put(UsecaseCronJob.MACHINE_IP, machine.getIp());
View Full Code Here

    }

    protected void sendNotification(Document authoringDocument) throws NotificationException,
            DocumentException, AccessControlException {

        User sender = getSession().getIdentity().getUser();

        String reason = getParameterAsString(REJECT_REASON);
        Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
                getLogger(), authoringDocument);
        Version versions[] = workflowable.getVersions();
        // current version is reject, want originating submit
        Version version = versions[versions.length - 2];

        // we assume that the document has been submitted, otherwise we do
        // nothing
        if (version.getEvent().equals("submit")) {

            String userId = version.getUserId();
            User user = PolicyUtil.getUser(this.manager, authoringDocument.getCanonicalWebappURL(),
                    userId, getLogger());

            Identifiable[] recipients = { user };

            Document authoringVersion = authoringDocument
View Full Code Here

     * @return <code>true</code> if the user was authenticated, <code>false</code> otherwise.
     */
    protected boolean authenticate(AccreditableManager accreditableManager, String username,
            String password, Identity identity) throws AccessControlException {

        User user = accreditableManager.getUserManager().getUser(username);
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Authenticating user: [" + user + "]");
        }

        boolean authenticated = false;
        if (user != null && user.authenticate(password)) {
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("User [" + user + "] authenticated.");
            }

            if (!identity.contains(user)) {
                User oldUser = identity.getUser();
                if (oldUser != null) {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("Removing user [" + oldUser + "] from identity.");
                    }
                    identity.removeIdentifiable(oldUser);
View Full Code Here

    }

    protected void sendNotification(Document authoringDocument) throws NotificationException,
            DocumentException, AccessControlException {

        User sender = getSession().getIdentity().getUser();

        User[] recipients = PolicyUtil.getUsersWithRole(this.manager, authoringDocument
                .getCanonicalWebappURL(), "review", getLogger());

        // check to see if current user can review their own submission
View Full Code Here

TOP

Related Classes of org.apache.lenya.ac.User

Copyright © 2018 www.massapicom. 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.