Package org.exist.security

Examples of org.exist.security.Subject


     */
    public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException
    {
        String jobName = args[0].getStringValue();

        Subject   user    = context.getUser();

        //Check if the user is a DBA
        if( !user.hasDbaRole() ) {
            return( BooleanValue.FALSE );
        }

        return( BooleanValue.valueOf( scheduler.pauseJob( jobName, UserJob.JOB_GROUP ) ) );
    }
View Full Code Here


     */
    public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException
    {
        String jobName = args[0].getStringValue();

        Subject   user    = context.getUser();

        //Check if the user is a DBA
        if( !user.hasDbaRole() ) {
            return( BooleanValue.FALSE );
        }

        return( BooleanValue.valueOf( scheduler.resumeJob( jobName, UserJob.JOB_GROUP ) ) );
    }
View Full Code Here

     * @see     org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence)
     */
    @Override
    public Sequence eval( Sequence[] args, Sequence contextSequence ) throws XPathException
    {
        Subject               user           = context.getUser();

        boolean            userhasDBARole = user.hasDbaRole();

        StringBuilder      xmlBuf         = new StringBuilder();

        int                iJobs          = 0;
        List<String>           groups         = scheduler.getJobGroupNames();
View Full Code Here

        if( isPeriodic && getArgumentCount() >= 6 ) {
            repeatValue = ( ( IntegerValue )args[5].itemAt( 0 ) ).getInt();
        }
   
        Subject user = context.getSubject();

        //Check if the user is a DBA
        if( !user.hasDbaRole() ) {
            return( BooleanValue.FALSE );
        }

        Object  job    = null;
        boolean isCron = true;
View Full Code Here

      BrokerPool database = null;
      DBBroker broker = null;
      try {
        database = BrokerPool.getInstance();
        broker = database.get(null);
        Subject subject = broker.getSubject();
       
        URL url = new URL("xmldb:exist://jsessionid:"+subject.getSessionId()+"@"+ uri.toString());
        connection = url.openConnection();
      } catch (IllegalArgumentException e) {
        throw new IOException(e);
      } catch (MalformedURLException e) {
        throw new IOException(e);
View Full Code Here

       
        final int UPDATE_NONE = 0;
        final int UPDATE_GROUP = 1;
        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);
View Full Code Here

    }
   
    private <R> R executeAsSystemUser(final LdapContext ctx, final Unit<R> unit) throws EXistException, PermissionDeniedException, NamingException {
       
        DBBroker broker = null;
        Subject currentSubject = getDatabase().getSubject();
        try {
            //elevate to system privs
            broker = getDatabase().get(getSecurityManager().getSystemSubject());
                   
            return unit.execute(ctx, broker);
View Full Code Here

    public void store() throws PermissionDeniedException, IOException, TriggerException, EXistException, SAXException, LockException, AuthenticationException {
      BrokerPool pool = null;
      DBBroker broker = null;   
      try {
            pool = BrokerPool.getInstance();
            Subject admin = pool.getSecurityManager().authenticate("admin", "");
            broker = pool.get(admin);
            Collection collection = broker.getOrCreateCollection(null, TestConstants.TEST_COLLECTION_URI);
            IndexInfo info = collection.validateXMLResource(null, broker, TestConstants.TEST_XML_URI, XML);
            //TODO : unlock the collection here ?
            collection.store(null, broker, info, XML, false);
View Full Code Here

        defaultProperties.setProperty(NORMALIZE_HTML, "yes");
    }

  public Resource getResource(Object r) throws XMLDBException {
    LocalCollection collection = null;
    Subject user = null;
   
    LocalXMLResource res = null;
    if (r instanceof NodeProxy) {
      NodeProxy p = (NodeProxy) r;
      res = new LocalXMLResource(user, db, collection, p);
View Full Code Here

        final NativeBroker broker = EasyMock.createMockBuilder(NativeBroker.class)
            .addMockedMethod("getCollection")
            .addMockedMethod("getSubject")
            .createStrictMock();

        final Subject subject = EasyMock.createStrictMock(Subject.class);

        //grant EXECUTE and READ permissions on the src
        expect(srcCollection.getPermissionsNoLock()).andReturn(srcPermissions);
        expect(broker.getSubject()).andReturn(subject);
        expect(srcPermissions.validate(subject, Permission.EXECUTE | Permission.READ)).andReturn(true);
View Full Code Here

TOP

Related Classes of org.exist.security.Subject

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.