org.hardtokenmgmt.ws.server
Class HTMFManageAdminsHelper

java.lang.Object
  extended by org.hardtokenmgmt.ws.server.HTMFAdminWSHelper
      extended by org.hardtokenmgmt.ws.server.HTMFManageAdminsHelper

public class HTMFManageAdminsHelper
extends HTMFAdminWSHelper

Contains help methods for administrators etc.

Version:
$Id$
Author:
Philip Vendil 13 jun 2009

Field Summary
 
Fields inherited from class org.hardtokenmgmt.ws.server.HTMFAdminWSHelper
intAdmin, softtokenids, softtokennames
 
Constructor Summary
HTMFManageAdminsHelper()
           
 
Method Summary
static boolean existsCertSNInAdminGroup(org.ejbca.core.model.log.Admin caller, AdminGroupVO agvo, java.lang.String certSN, int caId)
          Return if the administrators unique Id exists in the specified administration group.
static boolean existsUniqueIdInAdminGroup(org.ejbca.core.model.log.Admin caller, AdminGroupVO agvo, java.lang.String uniqueId)
          Return if the administrators unique Id exists in the specified administration group.
static java.util.List<AdminDataVO> filterSuperAdmins(java.util.List<AdminDataVO> admins, java.util.Set<AdminDataVO> superAdmins, java.lang.String orgId)
          Method that filter out administrators belonging to the super admin group.
static org.ejbca.core.model.authorization.AdminGroup findSuperAdminGroup()
           
static java.util.Set<AdminDataVO> findSuperAdmins(java.util.List<AdminDataVO> admins)
           
static java.util.List<AdminGroupVO> getAdminGroups(org.ejbca.core.model.log.Admin caller, java.lang.String orgId)
          Method that fetches all authorized administration groups belonging to the organization.
static java.util.List<AdminDataVO> getAdministratorsInOrganization(org.ejbca.core.model.log.Admin caller, java.lang.String orgId, java.util.List<java.lang.Integer> caIDs)
          Returns a list of AdminDataVO of all administrators belonging to an organization (a given set of caIds) The administration groups and CertSN aren't populated with this call, that have to be done separately.
static java.util.Set<java.lang.String> getOrgsWithCertSNMatch()
           
static java.lang.String getUniqueIdFieldFromDN(java.lang.String dN)
          Returns the unique id field from DN or null if not exists.
static java.lang.String getUniqueIdFieldType()
           
static void modifyAdminGroup(org.ejbca.core.model.log.Admin caller, AdminGroupVO agvo, java.lang.String matchValue, int caId, boolean matchCertSN, boolean add)
          Modifies an administration group to add or remove an AdminEntity.
 
Methods inherited from class org.hardtokenmgmt.ws.server.HTMFAdminWSHelper
convertUserDataVOWS, getBasicGlobalSettings, getCAIdsForOrganization, getCertificate, getOrganizationIdMapper, getTokenId, getUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMFManageAdminsHelper

public HTMFManageAdminsHelper()
Method Detail

filterSuperAdmins

public static java.util.List<AdminDataVO> filterSuperAdmins(java.util.List<AdminDataVO> admins,
                                                            java.util.Set<AdminDataVO> superAdmins,
                                                            java.lang.String orgId)
Method that filter out administrators belonging to the super admin group. If the organization id is the superadmin group will only superadmins remain but if organization id is not superadmins, they will be removed.

Parameters:
admins - list of adminDataVOs
orgId - of the organization
Returns:
filtered set of administrators

findSuperAdminGroup

public static final org.ejbca.core.model.authorization.AdminGroup findSuperAdminGroup()

findSuperAdmins

public static java.util.Set<AdminDataVO> findSuperAdmins(java.util.List<AdminDataVO> admins)

getAdminGroups

public static java.util.List<AdminGroupVO> getAdminGroups(org.ejbca.core.model.log.Admin caller,
                                                          java.lang.String orgId)
Method that fetches all authorized administration groups belonging to the organization.

Parameters:
caller - calling administrator
orgId - orgId to search for
Returns:
a list of authorized administration groups belonging to the organization

getAdministratorsInOrganization

public static java.util.List<AdminDataVO> getAdministratorsInOrganization(org.ejbca.core.model.log.Admin caller,
                                                                          java.lang.String orgId,
                                                                          java.util.List<java.lang.Integer> caIDs)
                                                                   throws org.ejbca.core.model.authorization.AuthorizationDeniedException
Returns a list of AdminDataVO of all administrators belonging to an organization (a given set of caIds) The administration groups and CertSN aren't populated with this call, that have to be done separately.

Parameters:
caller - the administrator performing the call
orgId - the unique organization id.
caIDs - belonging to the organization
Returns:
List of AdminDataVO
Throws:
org.ejbca.core.model.authorization.AuthorizationDeniedException

getUniqueIdFieldType

public static java.lang.String getUniqueIdFieldType()
Returns:
the setting 'admins.uniqueidfield' indicating which dn field that should be mapped against unique id.

getUniqueIdFieldFromDN

public static java.lang.String getUniqueIdFieldFromDN(java.lang.String dN)
Returns the unique id field from DN or null if not exists.


getOrgsWithCertSNMatch

public static java.util.Set<java.lang.String> getOrgsWithCertSNMatch()

existsUniqueIdInAdminGroup

public static boolean existsUniqueIdInAdminGroup(org.ejbca.core.model.log.Admin caller,
                                                 AdminGroupVO agvo,
                                                 java.lang.String uniqueId)
Return if the administrators unique Id exists in the specified administration group.

Parameters:
caller - the administrator performing the call
agvo - the administration group
uniqueId - the unique Id of the administrator.
Returns:
true if the unique id exists in the administration group otherwise false

existsCertSNInAdminGroup

public static boolean existsCertSNInAdminGroup(org.ejbca.core.model.log.Admin caller,
                                               AdminGroupVO agvo,
                                               java.lang.String certSN,
                                               int caId)
Return if the administrators unique Id exists in the specified administration group.

Parameters:
caller - the administrator performing the call
agvo - the administration group
certSN - the certificate SN of the certificate
caId - of the certificate.
Returns:
true if the unique id exists in the administration group otherwise false

modifyAdminGroup

public static void modifyAdminGroup(org.ejbca.core.model.log.Admin caller,
                                    AdminGroupVO agvo,
                                    java.lang.String matchValue,
                                    int caId,
                                    boolean matchCertSN,
                                    boolean add)
Modifies an administration group to add or remove an AdminEntity.

Parameters:
caller - the administrator performing the call
agvo - the administration group
matchValue - the certSN or unique ID to add or remove from administration group
caId - of the certificate.
matchCertSN - true if certificate SN should be used otherwise will unique id be used.
add - true if the user should be added to the group if it doesn't exist, otherwise it will be removed.