Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.User


        login("lenya");

        Session session = getFactory().getSession();

        User lenya = getAccreditableManager().getUserManager().getUser("lenya");
        User alice = getAccreditableManager().getUserManager().getUser("alice");

        Identifiable[] recipients = { alice };

        Message message = new Message(SUBJECT, new String[0], "body", new String[0], lenya,
                recipients);
View Full Code Here


    }

    protected void checkPostconditions() {
        Session session = getRequest().getSession();
        Identity identity = (Identity) session.getAttribute(Identity.class.getName());
        User user = identity.getUser();
        assertNotNull(user);
        assertEquals(user.getId(), USER_ID);
    }
View Full Code Here

    }

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

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

        String reason = getParameterAsString(PARAM_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

        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 in the accreditable manager [" + acMgr.getId() + "]!");
        }

        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

     * @return The identity.
     * @throws AccessControlException when something went wrong.
     */
    protected Identity getIdentity() throws AccessControlException {
        DefaultAccessController controller = getAccessController();
        User user = controller.getAccreditableManager().getUserManager().getUser(USERNAME);
        assertNotNull(user);

        Identity identity = new Identity();
        identity.enableLogging(getLogger());
        identity.addIdentifiable(user);
View Full Code Here

        this.group.removeAllMembers();

        List groupUsers = (List) getParameter(GROUP_USERS);
        for (Iterator i = groupUsers.iterator(); i.hasNext();) {
            User user = (User) i.next();
            this.group.add(user);
            user.save();
        }
    }
View Full Code Here

                String userId = getParameterAsString(OTHER_USER);
                if (userId != null) {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("add user [" + userId + "]");
                    }
                    User user = getUserManager().getUser(userId);
                    groupUsers.add(user);
                    otherUsers.remove(user);
                }
            }

            if (remove != null) {
                String userId = getParameterAsString(GROUP_USER);
                if (userId != null) {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("remove user [" + userId + "]");
                    }
                    User user = getUserManager().getUser(userId);
                    otherUsers.add(user);
                    groupUsers.remove(user);
                }
            }
View Full Code Here

        String adminRoleId = "adminRole";

        FileRole editorRole = new FileRole(configDir, editorRoleId);
        FileRole adminRole = new FileRole(configDir, adminRoleId);

        User user = new FileUser(configDir, userName, "Alice in Wonderland", "alice@test.com",
                "secret");

        editorRole.save();
        adminRole.save();

        Group editorGroup = new FileGroup(configDir, editorGroupId);

        //    editorGroup.addRole(editorRole);
        editorGroup.add(user);

        FileGroup adminGroup = new FileGroup(configDir, adminGroupId);

        //    adminGroup.addRole(editorRole);
        //    adminGroup.addRole(adminRole);
        editorGroup.save();
        adminGroup.save();
        adminGroup.add(user);
        user.save();

        FileGroupManager groupManager = null;
        UserType[] userTypes = { FileAccreditableManager.getDefaultUserType() };
        FileUserManager userManager = FileUserManager.instance(configDir, userTypes,
                getLogger());
View Full Code Here

        FileUserManager _manager = FileUserManager.instance(configDir, userTypes,
                getLogger());
        assertNotNull(_manager);
        _manager.add(user);

        User otherUser = _manager.getUser(userName);
        assertEquals(user, otherUser);
        assertEquals(user.getDescription(), otherUser.getDescription());
        assertEquals(user.getEmail(), otherUser.getEmail());
        assertEquals(user.getEncryptedPassword(), ((AbstractUser) otherUser).getEncryptedPassword());
    }
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.