Package org.ejbca.core.model.authorization

Examples of org.ejbca.core.model.authorization.AdminGroup


    }
   
    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
    @Override
    public AdminGroup getAdminGroup(final Admin admin, final String admingroupname) {
        AdminGroup returnval = null;
        final AdminGroupData agd = AdminGroupData.findByGroupName(entityManager, admingroupname);
        if (agd == null) {
            LOG.info("Can't get admingroup: " + admingroupname);
        } else {
            returnval = agd.getAdminGroup();
View Full Code Here


                getLogger().info("Description: " + getDescription());
                getLogger().info("Usage: " + getCommand() + " <name of group>");
                return;
            }
            String groupName = args[1];
            AdminGroup adminGroup = ejb.getAdminGroupSession().getAdminGroup(getAdmin(), groupName);
            if (adminGroup == null) {
                getLogger().error("No such group \"" + groupName + "\" .");
                return;
            }
            Collection<AdminEntity> list = adminGroup.getAdminEntities();
            for (AdminEntity adminEntity : list) {
                String caName = (String) ejb.getCAAdminSession().getCAIdToNameMap(getAdmin()).get(adminEntity.getCaId());
                if (caName == null) {
                    caName = "Unknown CA with id " + adminEntity.getCaId();
                }
View Full Code Here

          getLogger().info("Description: " + getDescription());
                getLogger().info("Usage: " + getCommand() + " <name of group>");
                return;
            }
            String groupName = args[1];
            AdminGroup adminGroup = ejb.getAdminGroupSession().getAdminGroup(getAdmin(), groupName);
            if (adminGroup == null) {
              getLogger().error("No such group \"" + groupName + "\" .");
                return;
            }
            List<AccessRule> list = (List<AccessRule>) adminGroup.getAccessRules();
            Collections.sort(list);
            for (AccessRule accessRule : list) {
              getLogger().info(getParsedAccessRule(accessRule.getAccessRule()) + " " + AccessRule.RULE_TEXTS[accessRule.getRule()] + " " + (accessRule.isRecursive() ? "RECURSIVE" : ""));
            }
        } catch (Exception e) {
View Full Code Here

    public void execute(String[] args) throws ErrorAdminCommandException {
        try {
            Collection<AdminGroup> adminGroups = ejb.getAdminGroupSession().getAuthorizedAdminGroupNames(getAdmin(), ejb.getCaSession().getAvailableCAs(getAdmin()));
            Collections.sort((List<AdminGroup>) adminGroups);
            for (AdminGroup adminGroupRep : adminGroups) {
                AdminGroup adminGroup = ejb.getAdminGroupSession().getAdminGroup(getAdmin(), adminGroupRep.getAdminGroupName());
                int numberOfAdmins = adminGroup.getNumberAdminEntities();
                getLogger().info(adminGroup.getAdminGroupName() + " (" + numberOfAdmins + " admin" + (numberOfAdmins == 1 ? "" : "s") + ")");
            }
        } catch (Exception e) {
            getLogger().error("", e);
            throw new ErrorAdminCommandException(e);
        }
View Full Code Here

                getLogger().info("Description: " + getDescription());
                getLogger().info("Usage: " + getCommand() + " <name of group> <name of issuing CA> <match with> <match type> <match value>");
                return;
            }
            String groupName = args[1];
            AdminGroup adminGroup = ejb.getAdminGroupSession().getAdminGroup(getAdmin(), groupName);
            if (adminGroup == null) {
                getLogger().error("No such group \"" + groupName + "\" .");
                return;
            }
            String caName = args[2];
            CAInfo caInfo = ejb.getCAAdminSession().getCAInfo(getAdmin(), caName);
            if (caInfo == null) {
                getLogger().error("No such CA \"" + caName + "\" .");
                return;
            }
            int matchWith = Arrays.asList(AdminEntity.MATCHWITHTEXTS).indexOf(args[3]);
            if (matchWith == -1) {
                getLogger().error("No such thing to match with as \"" + args[3] + "\" .");
                return;
            }
            int matchType = Arrays.asList(AdminEntity.MATCHTYPETEXTS).indexOf(args[4]) + 1000;
            if (matchType == (-1 + 1000)) {
                getLogger().error("No such type to match with as \"" + args[4] + "\" .");
                return;
            }
            String matchValue = args[5];
            int caid = ejb.getCAAdminSession().getCAInfo(getAdmin(), caName).getCAId();
            AdminEntity adminEntity = new AdminEntity(matchWith, matchType, matchValue, caid);

            Collection<AdminEntity> list = adminGroup.getAdminEntities();
            for (AdminEntity currentAdminEntity : list) {
                if (currentAdminEntity.getMatchValue().equals(adminEntity.getMatchValue()) && currentAdminEntity.getMatchWith() == adminEntity.getMatchWith()
                        && currentAdminEntity.getMatchType() == adminEntity.getMatchType() && currentAdminEntity.getCaId() == adminEntity.getCaId()) {
                    Collection<AdminEntity> adminEntities = new ArrayList<AdminEntity>();
                    adminEntities.add(adminEntity);
View Full Code Here

    }
    final Iterator<AccessRulesData> i2 = getAccessRules().iterator();
    while (i2.hasNext()) {
      accessrules.add(i2.next().getAccessRuleObject());
    }
    return new AdminGroup(getPrimeKey().intValue(), getAdminGroupName(), accessrules, adminentities);
  }
View Full Code Here

  /**
   * Returns an AdminGroup object only containing name and caid and no access data.
   */
  @Transient
  public AdminGroup getAdminGroupNames() {
    return new AdminGroup(getPrimeKey().intValue(), getAdminGroupName(), null, null);
  }
View Full Code Here

            userAdminSession.addUser(intAdmin, user1, true);
            userAdded = true;

            boolean adminExists = false;
            AdminGroup admingroup = adminGroupSession.getAdminGroup(intAdmin, AdminGroup.TEMPSUPERADMINGROUP);
            Iterator<AdminEntity> iter = admingroup.getAdminEntities().iterator();
            while (iter.hasNext()) {
                AdminEntity adminEntity = iter.next();
                if (adminEntity.getMatchValue().equals(TEST_ADMIN_USERNAME)) {
                    adminExists = true;
                }
View Full Code Here

    protected void cleanUpAdmins() throws Exception {
        if (userAdminSession.existsUser(intAdmin, TEST_ADMIN_USERNAME)) {
            // Remove from admin group
            CAInfo cainfo = caAdminSessionRemote.getCAInfo(intAdmin, getAdminCAName());
            AdminGroup admingroup = adminGroupSession.getAdminGroup(intAdmin, AdminGroup.TEMPSUPERADMINGROUP);
            Iterator<AdminEntity> iter = admingroup.getAdminEntities().iterator();
            while (iter.hasNext()) {
                AdminEntity adminEntity = iter.next();
                if (adminEntity.getMatchValue().equals(TEST_ADMIN_USERNAME)) {
                    ArrayList<AdminEntity> list = new ArrayList<AdminEntity>();
                    list.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASE, TEST_ADMIN_USERNAME, cainfo.getCAId()));
View Full Code Here

  }

  /** @return the current admin group for the current row in the datatable */
  private AdminGroup getCurrentAdminGroupObjectForEach() {
    String adminGroupName = ((AdminGroup) FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("adminGroup")).getAdminGroupName();
    AdminGroup adminGroup = null;
    try {
      adminGroup = getAuthorizationDataHandler().getAdminGroup(adminGroupName);
    } catch (AuthorizationDeniedException e) {
      addErrorMessage("AUTHORIZATIONDENIED");
    }
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.authorization.AdminGroup

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.