Package com.esri.gpt.framework.security.principal

Examples of com.esri.gpt.framework.security.principal.Users


*/
@Override
public Users readGroupMembers(String groupDN)
  throws IdentityException, NamingException, SQLException {
  LdapClient client = null;
  Users users = new Users();
  try {
    client = newServiceConnection();
    DirContext dirContext = client.getConnectedContext();
    LdapQueryFunctions queryF = client.getQueryFunctions();
    StringSet ssDNs = queryF.readGroupMembers(dirContext,groupDN);
    for (String sDN: ssDNs) {
      String sName = queryF.readUsername(dirContext,sDN);
      User user = new User();
      user.setDistinguishedName(sDN);
      user.setKey(user.getDistinguishedName());
      user.setName(sName);
      users.add(user);
    }
  } finally {
    if (client != null) client.close();
  }
  return users;
View Full Code Here


* @throws SQLException if a database communication exception occurs
*/
@Override
public Users readGroupMembers(String groupDN)
  throws IdentityException, NamingException, SQLException {
  Users users = new Users();
  User user = new User();
  user.setDistinguishedName(getDN());
  user.setKey(user.getDistinguishedName());
  user.setName(getUsername());
  users.add(user);
  return users;
}
View Full Code Here

      // build the where clause
      // TODO remove for the final version after merging
      sbWhere.append(" (A.PROTOCOL IS NOT NULL) ");
      if (!_ignoreUser) {
        Users users = buildSelectablePublishers(getRequestContext());
        if (users.size() > 0) {
          StringBuilder sb = new StringBuilder();
          for (User u : users.values()) {
            if (sb.length() > 0) {
              sb.append(",");
            }
            sb.append(Integer.toString(u.getLocalID()));
          }
View Full Code Here

   * @return list of selectable publishers
   * @throws SQLException
   */
  private Users buildSelectablePublishers(RequestContext context)
          throws SQLException {
    Users allUsers = Publisher.buildSelectablePublishers(context, false);
    Users validUsers = new Users();
    if (allUsers.size() > 0) {
      LocalDao localDao = new LocalDao(getRequestContext());
      for (User u : allUsers.values()) {
        try {
          localDao.ensureReferenceToRemoteUser(u);
          validUsers.add(u);
        } catch (IdentityException ex) {
          LogUtil.getLogger().severe(
                  "Error ensuring reference to the remote user: " + ex.getMessage());
        }
      }
View Full Code Here

* @param filter the user search filter for ldap
* @return the list of users matching filter
* @throws NamingException if an LDAP naming exception occurs
*/
protected Users readUsers(DirContext dirContext,String filter, String attributeName) throws NamingException
  Users users = new Users();
  NamingEnumeration<SearchResult> enSearch = null;
  try{
    LdapUserProperties userProps = getConfiguration().getUserProperties();
    String sNameAttribute = userProps.getUserDisplayNameAttribute();
      String sBaseDN = userProps.getUserSearchDIT();
      String sFilter = userProps.returnUserLoginSearchFilter(filter);
      if(attributeName != null){     
        sFilter = userProps.returnUserNewRequestSearchFilter(filter, attributeName);
      }
      SearchControls controls = new SearchControls();
      controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
      if (sNameAttribute.length() > 0) {
        String[] aReturn = new String[1];
        aReturn[0] = sNameAttribute;
        controls.setReturningAttributes(aReturn);
      }
     
      enSearch = dirContext.search(sBaseDN,sFilter,controls);
      try {
        while (enSearch.hasMore()) {
          SearchResult result = (SearchResult)enSearch.next();
          String sDN = buildFullDN(result.getName(),sBaseDN);
          if (sDN.length() > 0) {
            String sName = "";
            if (sNameAttribute.length() > 0) {
              Attribute attrName = result.getAttributes().get(sNameAttribute);
              if ((attrName != null) && (attrName.size() > 0)) {
                sName = Val.chkStr(attrName.get(0).toString());
              }
            }

              User user = new User();
              user.setDistinguishedName(sDN);
              user.setKey(user.getDistinguishedName());
              user.setName(sName);
              users.add(user);
          }
        }
      } catch (PartialResultException pre) {
        LogUtil.getLogger().finer(pre.toString());
      } catch (LimitExceededException lee) {
View Full Code Here

  if(filter.length() == 0) {
    response.getWriter().write("{ \"response\" : \"noResults\" }");
    return;
  }
  IdentityAdapter idAdapter = context.newIdentityAdapter();
  Users users = idAdapter.readUsers(filter,null);
  for (User u : users.values()){   
    if(isAddAttributeRequest){
      try{
        idAdapter.addAttribute(u.getDistinguishedName(), attributeName, attributeValue);
      }catch(AttributeInUseException aiue){
        // TODO : do nothing if attribute exists ? or overwrite ?
View Full Code Here

* @throws IdentityException if a system error occurs preventing the action
* @throws NamingException if an LDAP naming exception occurs
* @throws SQLException
*/
protected String serializeUsersAsJson(RequestContext context, String filter,String attributeName, boolean isMemberSearch) throws IdentityException, NamingException, SQLException {
  Users users = new Users();
  int totalMatches = 0;
  if(!isMemberSearch){
    HashMap<String,Object> resultsMap = buildUsersList(context, filter,null);
    users = (Users) resultsMap.get("topUserMatches");
    totalMatches = (Integer) resultsMap.get("totalMatches");
  }else if(isMemberSearch && attributeName != null){
    Roles configuredRoles = context.getIdentityConfiguration().getConfiguredRoles();
    Role role = configuredRoles.get(attributeName);
    String sDn = role.getDistinguishedName();
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    users = idAdapter.readGroupMembers(sDn);
    totalMatches = users.size();
    users.sort();
  }else{
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    Users members = idAdapter.readGroupMembers(filter);
      for (User u: members.values()) {
        users.add(u);     
      }
      users.sort();
      totalMatches = users.size();
  }
View Full Code Here

  String searchLimit = Val.chkStr(context.getCatalogConfiguration().getParameters().getValue("ldap.identity.search.maxResults"));
  int srchLimit = -1;
  if(searchLimit.length() > 0){
    srchLimit = Integer.parseInt(searchLimit);
  }
  Users users = idAdapter.readUsers(filter,attributeName);
  users.sort();
  int totalMatches = users.size();
  resultsMap.put("totalMatches", totalMatches);
  if(srchLimit == -1) {
    resultsMap.put("topUserMatches", users);
    return resultsMap;
  }
 
  if(attributeName != null){
    resultsMap.put("topUserMatches", users);
    return resultsMap;
  }
  Users topUserMatches = new Users();
  int count = 0;
  for (User user : users.values()){
    count++;   
    if(count <= srchLimit){
      topUserMatches.add(user);
    }else{
      break;
    }
  }
  resultsMap.put("topUserMatches", topUserMatches);
View Full Code Here

                break;
              }
            }
            // if does not exist, try to finf him and add to this list
            if (!bExist) {
              Users allSelectablePublishers =
                      Publisher.buildSelectablePublishers(context, true);
              User owner = allSelectablePublishers.get(uDN);
              if (owner != null) {
                getSelectablePublishers().getItems().add(
                        new SelectItem(owner.getKey(), owner.getName()));
              }
            }
View Full Code Here

  criteria.getDateRange().check();
  pageCursor.setTotalRecordCount(0);

  adminDao = new ImsMetadataAdminDao(getRequestContext());
  tblImsUser = getRequestContext().getCatalogConfiguration().getUserTableName();
  Users editablePublishers = Publisher.buildSelectablePublishers(getRequestContext(), false);
  for (User u : editablePublishers.values()) {
    if (u.getName().length() > 0) {
      hmEditablePublishers.put(u.getName().toLowerCase(), u.getKey());
    }
  }
  User tmpUser = new User();
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.security.principal.Users

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.