Package org.exist

Examples of org.exist.EXistException


   
    public boolean setUserPrimaryGroup(final String username, final String groupName) throws EXistException, PermissionDeniedException {
        final SecurityManager manager = factory.getBrokerPool().getSecurityManager();

      if(!manager.hasGroup(groupName)) {
            throw new EXistException("Group '" + groupName + "' does not exist!");
        }
       
        if(!manager.hasAdminPrivileges(user)) {
            throw new PermissionDeniedException("Not allowed to modify user");
        }
       
        try {
            executeWithBroker(new BrokerOperation<Void>() {
                @Override
                public Void withBroker(final DBBroker broker) throws EXistException, URISyntaxException, PermissionDeniedException {
                    final Account account = manager.getAccount(username);
                    final Group group = manager.getGroup(groupName);
                    account.setPrimaryGroup(group);
                    manager.updateAccount(account);
                    return null;
                }
            });
            return true;
        } catch (final URISyntaxException use) {
            throw new EXistException(use.getMessage(), use);
        }
    }
View Full Code Here


                        return null;
                    }
                });
                return true;
            } catch (final URISyntaxException use) {
                throw new EXistException(use.getMessage(), use);
            }
           
        } else {
            return false;
        }
View Full Code Here

                }

            });
            return new Vector<String>(groupMembers);
        } catch (final URISyntaxException use) {
            throw new EXistException(use.getMessage(), use);
        }
    }
View Full Code Here

                   
                    return null;
                }
            });
        } catch (final URISyntaxException use) {
            throw new EXistException(use.getMessage(), use);
        } catch (final PermissionDeniedException pde) {
            throw new EXistException(pde.getMessage(), pde);
        }
    }
View Full Code Here

                   
                    return null;
                }
            });
        } catch (final URISyntaxException use) {
            throw new EXistException(use.getMessage(), use);
        } catch (final PermissionDeniedException pde) {
            throw new EXistException(pde.getMessage(), pde);
        }
    }
View Full Code Here

                   
                    return null;
                }
            });
        } catch (final URISyntaxException use) {
            throw new EXistException(use.getMessage(), use);
        } catch (final PermissionDeniedException pde) {
            throw new EXistException(pde.getMessage(), pde);
        }
    }
View Full Code Here

                   
                    return null;
                }
            });
        } catch (final URISyntaxException use) {
            throw new EXistException(use.getMessage(), use);
        } catch (final PermissionDeniedException pde) {
            throw new EXistException(pde.getMessage(), pde);
        }
    }
View Full Code Here

        final Txn transaction = transact.beginTransaction();
        try {
            broker = factory.getBrokerPool().get(user);
            doc = broker.getXMLResource(docURI, Lock.WRITE_LOCK);          
            if (doc == null) {
                throw new EXistException("Resource " + docURI + " not found");
            }
            //TODO : register the lock within the transaction ?
            if (!doc.getPermissions().validate(user, Permission.WRITE))
                {throw new PermissionDeniedException("User is not allowed to lock resource " + docURI);}
            final SecurityManager manager = factory.getBrokerPool().getSecurityManager();
View Full Code Here

        DocumentImpl doc = null;
        try {
            broker = factory.getBrokerPool().get(user);
            doc = broker.getXMLResource(docURI, Lock.READ_LOCK);
            if (doc == null)
                {throw new EXistException("Resource " + docURI + " not found");}
            if(!doc.getPermissions().validate(user, Permission.READ))
                {throw new PermissionDeniedException("Insufficient privileges to read resource");}
            final Account u = doc.getUserLock();
            return u == null ? "" : u.getName();
View Full Code Here

        Txn transaction = null;
        try {
            broker = factory.getBrokerPool().get(user);
            doc = broker.getXMLResource(docURI, Lock.WRITE_LOCK);
            if (doc == null)
                {throw new EXistException("Resource " + docURI + " not found");}
            if (!doc.getPermissions().validate(user, Permission.WRITE))
                {throw new PermissionDeniedException("User is not allowed to lock resource " + docURI);}
            final SecurityManager manager = factory.getBrokerPool().getSecurityManager();
            final Account lockOwner = doc.getUserLock();
            if(lockOwner != null && (!lockOwner.equals(user)) && (!manager.hasAdminPrivileges(user)))
View Full Code Here

TOP

Related Classes of org.exist.EXistException

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.