Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.Identity


     * @throws AccessControlException when something went wrong.
     */
    public Situation getSituation(FOM_Cocoon cocoon) throws AccessControlException {
        Request request = ObjectModelHelper.getRequest(cocoon.getObjectModel());
        Session session = request.getSession();
        Identity identity = (Identity) session.getAttribute(Identity.class.getName());

        String userId = "";
        String ipAddress = "";

        User user = identity.getUser();
        if (user != null) {
            userId = user.getId();
        }

        Machine machine = identity.getMachine();
        if (machine != null) {
            ipAddress = machine.getIp();
        }

        Role[] roles = PolicyAuthorizer.getRoles(request);
View Full Code Here


     * @see RevisionController#reservedCheckIn(String, String, boolean)
     */
    public void reservedCheckIn(FOM_Cocoon cocoon, boolean backup)
    throws FileReservedCheckInException, Exception
    {
        final Identity identity = (Identity) ObjectModelHelper.getRequest(cocoon.getObjectModel()).getSession().getAttribute(Identity.class.getName());
        final PageEnvelope pageEnvelope = getPageEnvelope(cocoon);
        final Publication publication = getPageEnvelope(cocoon).getPublication();
        final String filename = pageEnvelope.getDocument().getFile().getAbsolutePath().substring(publication.getDirectory().getAbsolutePath().length());  
        getRevisionController(cocoon).reservedCheckIn(filename, identity.getUser().getId(), backup);
    }
View Full Code Here

        if (eventName != null) {
          Session session = request.getSession(false);
          if (session == null) {
            log.debug("No session found - not enabling workflow handling.");
          } else {
            Identity identity = Identity.getIdentity(session);
            if (identity == null) {
              log.debug("No identity found - not enabling workflow handling.");
            } else {
              log.debug("Identity found - enabling workflow handling.");
              Role[] roles;
View Full Code Here

    if (notificationMap.getMap().isEmpty()) {
      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

    protected Identity getIdentity() throws AccessControlException {
        DefaultAccessController controller = getAccessController();
        User user = controller.getAccreditableManager().getUserManager().getUser(USERNAME);
        assertNotNull(user);

        Identity identity = new Identity();
        identity.addIdentifiable(user);

        return identity;
    }
View Full Code Here

            instance = factory.buildInstance(document);
            assertNotNull(instance);

            System.out.println("Current state: " + instance.getCurrentState());

            Identity identity = new Identity();
            User user =
                getAccreditableManager().getUserManager().getUser(
                    situations[situationIndex].getUser());
            identity.addIdentifiable(user);

            Role[] roles = policy.getRoles(identity);
            System.out.print("Roles:");

            for (int roleIndex = 0; roleIndex < roles.length; roleIndex++) {
View Full Code Here

        if (username == null || password == null) {
            throw new AccessControlException("Username or password is null!");
        }

        Identity identity = (Identity) request.getSession(false).getAttribute(
                Identity.class.getName());
        boolean authenticated = authenticate(accreditableManager, username, password, identity);
        return authenticated;
    }
View Full Code Here

            getLogger().error(".act(): No session object");

            return null;
        }

        Identity identity = (Identity) session.getAttribute(Identity.class.getName());
        getLogger().debug(".act(): Identity: " + identity);

        //FIXME: hack because of the uri for the editor bitflux. The filename cannot be get from the page-envelope

        String documentid = document.getId();
        int bx = documentid.lastIndexOf("-bxeng");

        if (bx > 0) {
            String language = document.getLanguage();

            int l = documentid.length();
            int bxLength = "-bxeng".length();
            int lang = documentid.lastIndexOf("_", bx);
            int langLength = bx - lang;

            if (bx > 0 && bx + bxLength <= l) {
                documentid = documentid.substring(0, bx) + documentid.substring(bx + bxLength, l);

                if (lang > 0 && langLength + lang < l) {
                    language = documentid.substring(lang + 1, lang + langLength);
                    documentid =
                        documentid.substring(0, lang)
                            + documentid.substring(lang + langLength, l - bxLength);
                }
            }

            DocumentBuilder builder = publication.getDocumentBuilder();

            String srcUrl =
                builder.buildCanonicalUrl(publication, document.getArea(), documentid, language);
            Document srcDoc = builder.buildDocument(publication, srcUrl);
            File newFile = srcDoc.getFile();
            filename = newFile.getAbsolutePath();

        } else {
            filename = document.getFile().getAbsolutePath();
        }

        filename = filename.substring(publicationPath.length());
        log.debug("Filename: " + filename);

        username = null;

        if (identity != null) {
            User user = identity.getUser();
            if (user != null) {
                username = user.getId();
            }
        } else {
            getLogger().error(".act(): No identity yet");
View Full Code Here

                if (session == null) {
                    throw new Exception("No session");
                }

                Identity identity = (Identity) session.getAttribute(Identity.class.getName());
                org.apache.lenya.ac.Identity identityTwo =
                    (org.apache.lenya.ac.Identity) session.getAttribute(Identity.class.getName());
                String username = null;
                if (identity != null) {
                    User user = identity.getUser();
                    if (user != null) {
                        username = user.getId();
                    }
                } else if (identityTwo != null) {
                    username = identityTwo.getUser().getId();
View Full Code Here

            acResolver = (AccessControllerResolver) selector
                    .select(AccessControllerResolver.DEFAULT_RESOLVER);
            accessController = acResolver.resolveAccessController(url);

            PolicyManager policyManager = accessController.getPolicyManager();
            Identity identity = workflowable.getSession().getIdentity();
            AccreditableManager accreditableMgr = accessController
            .getAccreditableManager();
            Policy policy = policyManager.getPolicy(accreditableMgr, url);
            RoleManager roleManager = accreditableMgr.getRoleManager();
           
View Full Code Here

TOP

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

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.