Package org.exist.security

Examples of org.exist.security.Account


        if (LOG.isDebugEnabled()) {
          LOG.debug("Get request for account '"+name+"'.");
        }
       
        //first attempt to get the cached account
        final Account acct = super.getAccount(name);

        if(acct != null) {
            LOG.debug("Cached used.");
            //XXX: synchronize with LDAP
            return acct;
View Full Code Here


  /**
   * Test method for {@link org.exist.security.realm.ldap.LDAPRealm#authenticate(java.lang.String, java.lang.Object)}.
   */
  @Test
  public void testAuthenticate() {
    Account account = null;
    try {
      account = realm.authenticate("admin", "passwd");
    } catch (AuthenticationException e) {
      fail(e.getMessage());
    }
View Full Code Here

        DBBroker broker = null;
        try {
            broker = factory.getBrokerPool().get(user);

            final Account u = factory.getBrokerPool().getSecurityManager().getAccount(name);
            if (u == null) {
                throw new EXistException("account '" + name + "' does not exist");
            }
         
            final HashMap<String, Object> tab = new HashMap<String, Object>();
            tab.put("uid", user.getId());
            tab.put("name", u.getName());

            final Vector<String> groups = new Vector<String>();
            final String[] groupNames = u.getGroups();
            for(final String groupName : groupNames) {
                groups.addElement(groupName);
            }
            tab.put("groups", groups);

            final Group dg = u.getDefaultGroup();
            if(dg != null) {
                tab.put("default-group-id", dg.getId());
                tab.put("default-group-realmId", dg.getRealmId());
                tab.put("default-group-name", dg.getName());
            }
           
            tab.put("enabled", Boolean.toString(u.isEnabled()));
           
            tab.put("umask", u.getUserMask());
           
            final Map<String, String> metadata = new HashMap<String, String>();
            for(final SchemaType key : u.getMetadataKeys()) {
                metadata.put(key.getNamespace(), u.getMetadataValue(key));
            }
            tab.put("metadata", metadata);
           
            return tab;
       
View Full Code Here

       
        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;
View Full Code Here

         try {
            executeWithBroker(new BrokerOperation<Void>() {
                @Override
                public Void withBroker(final DBBroker broker) throws EXistException, PermissionDeniedException {
                    final SecurityManager sm = broker.getBrokerPool().getSecurityManager();
                    final Account account = sm.getAccount(accountName);
                    account.addGroup(groupName);
                    sm.updateAccount(account);
                   
                    return null;
                }
            });
View Full Code Here

            executeWithBroker(new BrokerOperation<Void>() {
                @Override
                public Void withBroker(final DBBroker broker) throws EXistException, PermissionDeniedException {
                    final SecurityManager sm = broker.getBrokerPool().getSecurityManager();
                   
                    final Account account = sm.getAccount(manager);
                    final Group group = sm.getGroup(groupName);
                    group.addManager(account);
                    sm.updateGroup(group);
                   
                    return null;
View Full Code Here

            executeWithBroker(new BrokerOperation<Void>() {
                @Override
                public Void withBroker(final DBBroker broker) throws EXistException, PermissionDeniedException {
                    final SecurityManager sm = broker.getBrokerPool().getSecurityManager();
                    final Group group = sm.getGroup(groupName);
                    final Account account = sm.getAccount(manager);
                   
                    group.removeManager(account);
                    sm.updateGroup(group);
                   
                    return null;
View Full Code Here

            executeWithBroker(new BrokerOperation<Void>() {
                @Override
                public Void withBroker(final DBBroker broker) throws EXistException, PermissionDeniedException {
                    final SecurityManager sm = broker.getBrokerPool().getSecurityManager();
                   
                    final Account account = sm.getAccount(member);
                    account.remGroup(group);
                    sm.updateAccount(account);
                   
                    return null;
                }
            });
View Full Code Here

        DBBroker broker = null;

        try {
          broker = factory.getBrokerPool().get(user);
         
          Account u;

          if (!manager.hasAccount(name)) {
            u = new UserAider(name);
          } else {
            u = manager.getAccount(name);
          }

          for (final String g : groups) {
            if (!u.hasGroup(g)) {
              u.addGroup(g);
            }
          }

          return manager.updateAccount(u);
         
View Full Code Here

      DBBroker broker = null;

      try {
        broker = factory.getBrokerPool().get(user);

        final Account u = manager.getAccount(name);
       
        for (final String g : groups) {
          if (g.equals(rgroup)) {
            u.remGroup(g);
          }
        }
       
        return manager.updateAccount(u);
View Full Code Here

TOP

Related Classes of org.exist.security.Account

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.