Package org.exist.security

Examples of org.exist.security.PermissionDeniedException


            broker = pool.get(user);
            collection = broker.openCollection(name, Lock.READ_LOCK);
            if (collection == null)
                {throw new EXistException("Collection " + name + " not found");}
            if (!collection.getPermissionsNoLock().validate(user, Permission.READ))
                {throw new PermissionDeniedException(
                        "not allowed to read collection " + name);}
            final EntityPermissions[] result = new EntityPermissions[collection.getChildCollectionCount(broker)];
            XmldbURI child, path;
            Collection childColl;
            Permission perm;
View Full Code Here


            broker = pool.get(user);
            collection = broker.openCollection(name, Lock.READ_LOCK);
            if (collection == null)
                {throw new EXistException("Collection " + name + " not found");}
            if (!collection.getPermissionsNoLock().validate(user, Permission.READ))
                {throw new PermissionDeniedException(
                        "not allowed to read collection " + name);}
            final EntityPermissions[] result = new EntityPermissions[collection.getDocumentCount(broker)];
            DocumentImpl doc;
            Permission perm;
            int cnt = 0;
View Full Code Here

            throw new ConfigurationException("OAuth realm can not create primary group 'OAuth'.");
         
        } catch (PermissionDeniedException e) {
          throw e;
        } catch (ConfigurationException e) {
          throw new PermissionDeniedException(e);
        } catch (EXistException e) {
          throw new PermissionDeniedException(e);
        }
    }
    return primaryGroup;
  }
View Full Code Here

            throw new IOException(e);

        } catch (LockException e) {
            LOG.error(e);
            txnManager.abort(txn);
            throw new PermissionDeniedException(xmldbUri + "");

        } catch (IOException | PermissionDeniedException e) {
            LOG.error(e);
            txnManager.abort(txn);
            throw e;
View Full Code Here

                    && !userLock.getName().equals(subject.getName())
                    && !subject.hasDbaRole() ) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug(String.format("Resource is locked by user %s.", userLock.getName()));
                }
                throw new PermissionDeniedException(userLock.getName());
            }

            // Check for request for shared lock. @@TODO
            if (inputToken.getScope() == LockToken.LOCK_SCOPE_SHARED) {
                if (LOG.isDebugEnabled()) {
View Full Code Here

            }

            // Check if Resource is from subject
            if (!lock.getName().equals(subject.getName()) && !subject.hasDbaRole() ) {
                LOG.debug(String.format("Resource lock is from user %s", lock.getName()));
                throw new PermissionDeniedException(lock.getName());
            }

            // Update document
            document.setUserLock(null);
            document.getMetadata().setLockToken(null);
View Full Code Here

            if (userLock.getName() != null && !userLock.getName().equals(subject.getName())
                    && !subject.hasDbaRole()) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug(String.format("Resource is locked by %s", userLock.getName()));
                }
                throw new PermissionDeniedException(userLock.getName());
            }

            LockToken lockToken = document.getMetadata().getLockToken();

            if (!token.equals(lockToken.getOpaqueLockToken())) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Token does not match");
                }
                throw new PermissionDeniedException(String.format("Token %s does not match %s", token, lockToken.getOpaqueLockToken()));
            }

            lockToken.setTimeOut(LockToken.LOCK_TIMEOUT_INFINITE);

            // Make token persistant
View Full Code Here

        final int UPDATE_METADATA = 2;
       
        final Subject invokingUser = getSecurityManager().getCurrentSubject();
       
        if(!invokingUser.hasDbaRole() && invokingUser.getId() != account.getId()) {
            throw new PermissionDeniedException("You do not have permission to modify the account");
        }
       
        try {
            final LdapContext ctx = getContext(invokingUser);
            final SearchResult ldapUser = findAccountByAccountName(ctx, account.getName());
View Full Code Here

                    continue;
                }
                final DocumentImpl  doc = (DocumentImpl)node.getOwnerDocument();
                doc.getMetadata().setIndexListener(listener);
                if (!doc.getPermissions().validate(broker.getSubject(), Permission.WRITE)) {
                     throw new PermissionDeniedException("User '" + broker.getSubject().getName() + "' does not have permission to write to the document '" + doc.getDocumentURI() + "'!");
                }
                switch (node.getNodeType()) {
                    case Node.ELEMENT_NODE:
                        if (modifications == 0) {modifications = 1;}
                        ((ElementImpl) node).update(transaction, children);
View Full Code Here

      for (int i = 0; i < ql.length; i++) {
        final StoredNode node = ql[i];
                final DocumentImpl doc = (DocumentImpl)node.getOwnerDocument();
        if (!doc.getPermissions().validate(broker.getSubject(),
            Permission.WRITE)) {
                    throw new PermissionDeniedException("User '" + broker.getSubject().getName() + "' does not have permission to write to the document '" + doc.getDocumentURI() + "'!");
                                }
        doc.getMetadata().setIndexListener(listener);
        parent = (NodeImpl) node.getParentNode();
                if (parent == null || parent.getNodeType() != Node.ELEMENT_NODE) {
          throw new EXistException(
View Full Code Here

TOP

Related Classes of org.exist.security.PermissionDeniedException

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.