Search in sources :

Example 91 with SecurityGroup

use of org.olat.basesecurity.SecurityGroup in project OpenOLAT by OpenOLAT.

the class LDAPLoginManagerImpl method getIdentitysDeletedInLdap.

/**
 * Creates list of all OLAT Users which have been deleted out of the LDAP
 * directory but still exits in OLAT
 *
 * Configuration: Required Attributes = ldapContext.xml (property=reqAttrs)
 * LDAP Base = ldapContext.xml (property=ldapBase)
 *
 * @param syncTime The time to search in LDAP for changes since this time.
 *          SyncTime has to formatted: JJJJMMddHHmm
 * @param ctx The LDAP system connection, if NULL or closed NamingExecpiton is
 *          thrown
 *
 * @return Returns list of Identity from the user which have been deleted in
 *         LDAP
 *
 * @throws NamingException
 */
public List<Identity> getIdentitysDeletedInLdap(LdapContext ctx) {
    if (ctx == null)
        return null;
    // Find all LDAP Users
    String userID = syncConfiguration.getOlatPropertyToLdapAttribute(LDAPConstants.LDAP_USER_IDENTIFYER);
    String userFilter = syncConfiguration.getLdapUserFilter();
    final List<String> ldapList = new ArrayList<String>();
    ldapDao.searchInLdap(new LDAPVisitor() {

        @Override
        public void visit(SearchResult result) throws NamingException {
            Attributes attrs = result.getAttributes();
            NamingEnumeration<? extends Attribute> aEnum = attrs.getAll();
            while (aEnum.hasMore()) {
                Attribute attr = aEnum.next();
                // use lowercase username
                ldapList.add(attr.get().toString().toLowerCase());
            }
        }
    }, (userFilter == null ? "" : userFilter), new String[] { userID }, ctx);
    if (ldapList.isEmpty()) {
        log.warn("No users in LDAP found, can't create deletionList!!", null);
        return null;
    }
    // Find all User in OLAT, members of LDAPSecurityGroup
    SecurityGroup ldapGroup = securityManager.findSecurityGroupByName(LDAPConstants.SECURITY_GROUP_LDAP);
    if (ldapGroup == null) {
        log.error("Error getting users from OLAT security group '" + LDAPConstants.SECURITY_GROUP_LDAP + "' : group does not exist", null);
        return null;
    }
    List<Identity> identityListToDelete = new ArrayList<Identity>();
    List<Identity> olatListIdentity = securityManager.getIdentitiesOfSecurityGroup(ldapGroup);
    for (Identity ida : olatListIdentity) {
        // compare usernames with lowercase
        if (!ldapList.contains(ida.getName().toLowerCase())) {
            identityListToDelete.add(ida);
        }
    }
    return identityListToDelete;
}
Also used : Attribute(javax.naming.directory.Attribute) BasicAttribute(javax.naming.directory.BasicAttribute) ArrayList(java.util.ArrayList) Attributes(javax.naming.directory.Attributes) SearchResult(javax.naming.directory.SearchResult) NamingEnumeration(javax.naming.NamingEnumeration) SecurityGroup(org.olat.basesecurity.SecurityGroup) NamingException(javax.naming.NamingException) Identity(org.olat.core.id.Identity)

Example 92 with SecurityGroup

use of org.olat.basesecurity.SecurityGroup in project OpenOLAT by OpenOLAT.

the class LDAPLoginModule method init.

/**
 * @see org.olat.core.configuration.Initializable#init()
 */
@Override
public void init() {
    // Check if LDAP is enabled
    if (!isLDAPEnabled()) {
        log.info("LDAP login is disabled");
        return;
    }
    log.info("Starting LDAP module");
    // Create LDAP Security Group if not existing. Used to identify users that
    // have to be synced with LDAP
    SecurityGroup ldapGroup = securityManager.findSecurityGroupByName(LDAPConstants.SECURITY_GROUP_LDAP);
    if (ldapGroup == null) {
        ldapGroup = securityManager.createAndPersistNamedSecurityGroup(LDAPConstants.SECURITY_GROUP_LDAP);
    }
    // check for valid configuration
    if (!checkConfigParameterIsNotEmpty(ldapUrl))
        return;
    if (!checkConfigParameterIsNotEmpty(systemDN))
        return;
    if (!checkConfigParameterIsNotEmpty(systemPW))
        return;
    if (syncConfiguration.getLdapBases() == null || syncConfiguration.getLdapBases().isEmpty()) {
        log.error("Missing configuration 'ldapBases'. Add at least one LDAP Base to the this configuration in olatextconfig.xml first. Disabling LDAP");
        setEnableLDAPLogins(false);
        return;
    }
    if (syncConfiguration.getLdapUserFilter() != null) {
        if (!syncConfiguration.getLdapUserFilter().startsWith("(") || !syncConfiguration.getLdapUserFilter().endsWith(")")) {
            log.error("Wrong configuration 'ldapUserFilter'. Set filter to emtpy value or enclose filter in brackets like '(objectClass=person)'. Disabling LDAP");
            setEnableLDAPLogins(false);
            return;
        }
    }
    if (!checkConfigParameterIsNotEmpty(syncConfiguration.getLdapUserCreatedTimestampAttribute())) {
        return;
    }
    if (!checkConfigParameterIsNotEmpty(syncConfiguration.getLdapUserLastModifiedTimestampAttribute())) {
        return;
    }
    if (syncConfiguration.getUserAttributeMap() == null || syncConfiguration.getUserAttributeMap().isEmpty()) {
        log.error("Missing configuration 'userAttrMap'. Add at least the email propery to the this configuration in olatextconfig.xml first. Disabling LDAP");
        setEnableLDAPLogins(false);
        return;
    }
    if (syncConfiguration.getRequestAttributes() == null || syncConfiguration.getRequestAttributes().isEmpty()) {
        log.error("Missing configuration 'reqAttr'. Add at least the email propery to the this configuration in olatextconfig.xml first. Disabling LDAP");
        setEnableLDAPLogins(false);
        return;
    }
    // check if OLAT user properties is defined in olat_userconfig.xml, if not disable the LDAP module
    if (!syncConfiguration.checkIfOlatPropertiesExists(syncConfiguration.getUserAttributeMap())) {
        log.error("Invalid LDAP OLAT properties mapping configuration (userAttrMap). Disabling LDAP");
        setEnableLDAPLogins(false);
        return;
    }
    if (!syncConfiguration.checkIfOlatPropertiesExists(syncConfiguration.getRequestAttributes())) {
        log.error("Invalid LDAP OLAT properties mapping configuration (reqAttr). Disabling LDAP");
        setEnableLDAPLogins(false);
        return;
    }
    if (syncConfiguration.getSyncOnlyOnCreateProperties() != null && !syncConfiguration.checkIfStaticOlatPropertiesExists(syncConfiguration.getSyncOnlyOnCreateProperties())) {
        log.error("Invalid LDAP OLAT syncOnlyOnCreateProperties configuration. Disabling LDAP");
        setEnableLDAPLogins(false);
        return;
    }
    if (syncConfiguration.getStaticUserProperties() != null && !syncConfiguration.checkIfStaticOlatPropertiesExists(syncConfiguration.getStaticUserProperties().keySet())) {
        log.error("Invalid static OLAT properties configuration (staticUserProperties). Disabling LDAP");
        setEnableLDAPLogins(false);
        return;
    }
    // check SSL certifications, throws Startup Exception if certificate is not found
    if (isSslEnabled()) {
        if (!checkServerCertValidity(0)) {
            log.error("LDAP enabled but no valid server certificate found. Please fix!");
        } else if (!checkServerCertValidity(30)) {
            log.warn("Server Certificate will expire in less than 30 days.");
        }
    }
    // Start LDAP cron sync job
    if (isLdapSyncCronSync()) {
        initCronSyncJob();
    } else {
        log.info("LDAP cron sync is disabled");
    }
    // OK, everything finished checkes passed
    log.info("LDAP login is enabled");
}
Also used : SecurityGroup(org.olat.basesecurity.SecurityGroup)

Example 93 with SecurityGroup

use of org.olat.basesecurity.SecurityGroup in project OpenOLAT by OpenOLAT.

the class InvitationEditRightsController method validateFormLogic.

@Override
protected boolean validateFormLogic(UserRequest ureq) {
    boolean allOk = true;
    mailEl.clearError();
    if (mailEl != null) {
        String mail = mailEl.getValue();
        if (StringHelper.containsNonWhitespace(mail)) {
            if (MailHelper.isValidEmailAddress(mail)) {
                SecurityGroup allUsers = securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
                List<Identity> shareWithIdentities = userManager.findIdentitiesByEmail(Collections.singletonList(mail));
                if (isAtLeastOneInSecurityGroup(shareWithIdentities, allUsers)) {
                    mailEl.setErrorKey("map.share.with.mail.error.olatUser", new String[] { mail });
                    allOk &= false;
                }
            } else {
                mailEl.setErrorKey("error.mail.invalid", null);
                allOk &= false;
            }
        } else {
            mailEl.setErrorKey("form.legende.mandatory", null);
            allOk &= false;
        }
    }
    firstNameEl.clearError();
    if (!StringHelper.containsNonWhitespace(firstNameEl.getValue())) {
        firstNameEl.setErrorKey("form.legende.mandatory", null);
        allOk &= false;
    }
    lastNameEl.clearError();
    if (!StringHelper.containsNonWhitespace(lastNameEl.getValue())) {
        lastNameEl.setErrorKey("form.legende.mandatory", null);
        allOk &= false;
    }
    return allOk & super.validateFormLogic(ureq);
}
Also used : SecurityGroup(org.olat.basesecurity.SecurityGroup) Identity(org.olat.core.id.Identity)

Example 94 with SecurityGroup

use of org.olat.basesecurity.SecurityGroup in project OpenOLAT by OpenOLAT.

the class SystemRegistrationManager method getRegistrationPropertiesMessage.

public Map<String, String> getRegistrationPropertiesMessage() {
    Map<String, String> msgProperties = new HashMap<String, String>();
    boolean website = registrationModule.isPublishWebsite();
    boolean notify = registrationModule.isNotifyReleases();
    // OLAT version
    msgProperties.put("appName", Settings.getApplicationName());
    msgProperties.put("version", Settings.getFullVersionInfo());
    // Location
    msgProperties.put("location", registrationModule.getLocation());
    msgProperties.put("locationCSV", registrationModule.getLocationCoordinates());
    // System config
    msgProperties.put("instantMessagingEnabled", String.valueOf(CoreSpringFactory.getImpl(InstantMessagingModule.class).isEnabled()));
    msgProperties.put("enabledLanguages", CoreSpringFactory.getImpl(I18nModule.class).getEnabledLanguageKeys().toString());
    msgProperties.put("clusterEnabled", clusterMode);
    msgProperties.put("debuggingEnabled", String.valueOf(Settings.isDebuging()));
    // Course counts
    int allCourses = repositoryManager.countByTypeLimitAccess(CourseModule.ORES_TYPE_COURSE, RepositoryEntry.ACC_OWNERS);
    int publishedCourses = repositoryManager.countByTypeLimitAccess(CourseModule.ORES_TYPE_COURSE, RepositoryEntry.ACC_USERS);
    msgProperties.put("courses", String.valueOf(allCourses));
    msgProperties.put("coursesPublished", String.valueOf(publishedCourses));
    // User counts
    SecurityGroup olatuserGroup = securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
    int users = securityManager.countIdentitiesOfSecurityGroup(olatuserGroup);
    long disabled = securityManager.countIdentitiesByPowerSearch(null, null, true, null, null, null, null, null, null, null, Identity.STATUS_LOGIN_DENIED);
    msgProperties.put("usersEnabled", String.valueOf(users - disabled));
    PermissionOnResourceable[] permissions = { new PermissionOnResourceable(Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR) };
    long authors = securityManager.countIdentitiesByPowerSearch(null, null, true, null, permissions, null, null, null, null, null, null);
    msgProperties.put("authors", String.valueOf(authors));
    // Activity
    Calendar lastLoginLimit = Calendar.getInstance();
    // -1 - 6 = -7 for last week
    lastLoginLimit.add(Calendar.DAY_OF_YEAR, -6);
    Long activeUsersLastWeek = securityManager.countUniqueUserLoginsSince(lastLoginLimit.getTime());
    msgProperties.put("activeUsersLastWeek", String.valueOf(activeUsersLastWeek));
    lastLoginLimit = Calendar.getInstance();
    lastLoginLimit.add(Calendar.MONTH, -1);
    Long activeUsersLastMonth = securityManager.countUniqueUserLoginsSince(lastLoginLimit.getTime());
    msgProperties.put("activeUsersLastMonth", String.valueOf(activeUsersLastMonth));
    // Groups
    SearchBusinessGroupParams params = new SearchBusinessGroupParams();
    int groups = businessGroupService.countBusinessGroups(params, null);
    msgProperties.put("buddyGroups", String.valueOf(groups));
    msgProperties.put("learningGroups", String.valueOf(groups));
    msgProperties.put("rightGroups", String.valueOf(groups));
    msgProperties.put("groups", String.valueOf(groups));
    // URL
    msgProperties.put("url", Settings.getServerContextPathURI());
    msgProperties.put("publishWebsite", String.valueOf(website));
    // Description
    String desc = registrationModule.getWebsiteDescription();
    msgProperties.put("description", desc);
    if (notify) {
        // Email
        String email = registrationModule.getEmail();
        msgProperties.put("email", email);
    }
    return msgProperties;
}
Also used : I18nModule(org.olat.core.util.i18n.I18nModule) HashMap(java.util.HashMap) Calendar(java.util.Calendar) SecurityGroup(org.olat.basesecurity.SecurityGroup) InstantMessagingModule(org.olat.instantMessaging.InstantMessagingModule) SearchBusinessGroupParams(org.olat.group.model.SearchBusinessGroupParams) PermissionOnResourceable(org.olat.basesecurity.PermissionOnResourceable)

Example 95 with SecurityGroup

use of org.olat.basesecurity.SecurityGroup in project OpenOLAT by OpenOLAT.

the class UserAdminMainController method initComponentFromMenuCommand.

private Component initComponentFromMenuCommand(Object uobject, UserRequest ureq) {
    // in any case release delete user gui lock (reaquired if user deletion is again clicked)
    releaseDeleteUserLock();
    if (uobject instanceof GenericActionExtension) {
        GenericActionExtension ae = (GenericActionExtension) uobject;
        TreeNode node = ((GenericTreeModel) olatMenuTree.getTreeModel()).findNodeByUserObject(uobject);
        OLATResourceable ores = OresHelper.createOLATResourceableInstance("AE", new Long(node.getPosition()));
        WindowControl bwControl = addToHistory(ureq, ores, null);
        contentCtr = ae.createController(ureq, bwControl, null);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    }
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(uobject.toString(), 0l);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
    // first check if it is node which opens a subtree with further uobject.tree.commands
    if (uobject.equals("menuroles")) {
        if (rolesVC == null) {
            rolesVC = createVelocityContainer("systemroles");
        }
        addToHistory(ureq, bwControl);
        return rolesVC;
    } else if (uobject.equals("menuqueries")) {
        if (queriesVC == null) {
            queriesVC = createVelocityContainer("predefinedqueries");
        }
        addToHistory(ureq, bwControl);
        return queriesVC;
    } else if (uobject.equals("menuaccess")) {
        if (queriesVC == null) {
            queriesVC = createVelocityContainer("systemroles");
        }
        addToHistory(ureq, bwControl);
        return queriesVC;
    } else if (uobject.equals("userdelete")) {
        // creates the user deletin controller
        // if locking fails -> a contentCtrl is created
        // -> hence removeAsListenerAndDispose(contentCtr) is delegated to the method called!
        addToHistory(ureq, bwControl);
        return createAndLockUserDeleteController(ureq, bwControl);
    } else if (uobject.equals("userdelete_direct")) {
        // creates the user deletin controller
        // if locking fails -> a contentCtrl is created
        // -> hence removeAsListenerAndDispose(contentCtr) is delegated to the method called!
        addToHistory(ureq, bwControl);
        return createAndLockDirectUserDeleteController(ureq, bwControl);
    }
    if (uobject.equals("usearch") || uobject.equals("useradmin")) {
        if (contentCtr != userSearchCtrl) {
            activatePaneInDetailView = null;
            contentCtr = userSearchCtrl = new UsermanagerUserSearchController(ureq, bwControl);
            listenTo(contentCtr);
        }
        addToHistory(ureq, bwControl);
        return contentCtr.getInitialComponent();
    }
    // these nodes re-create (not stateful) content Controller (contentCtrl)
    removeAsListenerAndDispose(contentCtr);
    if (uobject.equals("ucreate")) {
        activatePaneInDetailView = null;
        boolean canCreateOLATPassword = false;
        if (ureq.getUserSession().getRoles().isOLATAdmin()) {
            // admin will override configuration
            canCreateOLATPassword = true;
        } else {
            Boolean canCreatePwdByConfig = BaseSecurityModule.USERMANAGER_CAN_CREATE_PWD;
            canCreateOLATPassword = canCreatePwdByConfig.booleanValue();
        }
        contentCtr = new UserCreateController(ureq, bwControl, canCreateOLATPassword);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("usersimport")) {
        activatePaneInDetailView = null;
        boolean canCreateOLATPassword = false;
        if (ureq.getUserSession().getRoles().isOLATAdmin()) {
            // admin will override configuration
            canCreateOLATPassword = true;
        } else {
            Boolean canCreatePwdByConfig = BaseSecurityModule.USERMANAGER_CAN_CREATE_PWD;
            canCreateOLATPassword = canCreatePwdByConfig.booleanValue();
        }
        contentCtr = new UserImportController(ureq, bwControl, canCreateOLATPassword);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("admingroup")) {
        activatePaneInDetailView = null;
        SecurityGroup[] secGroup = { securityManager.findSecurityGroupByName(Constants.GROUP_ADMIN) };
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, secGroup, null, null, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("authorgroup")) {
        activatePaneInDetailView = "edit.uroles";
        SecurityGroup[] secGroup = { securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS) };
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, secGroup, null, null, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("coauthors")) {
        activatePaneInDetailView = "edit.uroles";
        // special case: use user search controller and search for all users that have author rights
        List<Identity> resourceOwners = repositoryService.getIdentitiesWithRole(GroupRoles.owner.name());
        UsermanagerUserSearchController myCtr = new UsermanagerUserSearchController(ureq, bwControl, resourceOwners, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        // now subtract users that are in the author group to get the co-authors
        SecurityGroup[] secGroup = { securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS) };
        List<Identity> identitiesFromAuthorGroup = securityManager.getVisibleIdentitiesByPowerSearch(null, null, true, secGroup, null, null, null, null);
        myCtr.removeIdentitiesFromSearchResult(ureq, identitiesFromAuthorGroup);
        contentCtr = myCtr;
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("resourceowners")) {
        activatePaneInDetailView = "edit.uroles";
        // First get all resource owners (co-authors) ...
        List<Identity> resourceOwners = repositoryService.getIdentitiesWithRole(GroupRoles.owner.name());
        UsermanagerUserSearchController myCtr = new UsermanagerUserSearchController(ureq, bwControl, resourceOwners, Identity.STATUS_VISIBLE_LIMIT, true);
        // ... now add users that are in the author group but don't own a resource yet
        SecurityGroup[] secGroup = { securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS) };
        List<Identity> identitiesFromAuthorGroup = securityManager.getVisibleIdentitiesByPowerSearch(null, null, true, secGroup, null, null, null, null);
        myCtr.addIdentitiesToSearchResult(ureq, identitiesFromAuthorGroup);
        contentCtr = myCtr;
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("courseparticipants")) {
        activatePaneInDetailView = "edit.courses";
        List<Identity> resourceOwners = repositoryService.getIdentitiesWithRole(GroupRoles.participant.name());
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, resourceOwners, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("groupmanagergroup")) {
        activatePaneInDetailView = "edit.uroles";
        SecurityGroup[] secGroup = { securityManager.findSecurityGroupByName(Constants.GROUP_GROUPMANAGERS) };
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, secGroup, null, null, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    }
    if (uobject.equals("coursecoach")) {
        activatePaneInDetailView = "edit.uroles";
        List<Identity> coaches = repositoryService.getIdentitiesWithRole(GroupRoles.coach.name());
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, coaches, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    }
    if (uobject.equals("groupcoach")) {
        activatePaneInDetailView = "edit.uroles";
        List<Identity> coaches = businessGroupService.getIdentitiesWithRole(GroupRoles.coach.name());
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, coaches, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("usermanagergroup")) {
        activatePaneInDetailView = "edit.uroles";
        SecurityGroup[] secGroup = { securityManager.findSecurityGroupByName(Constants.GROUP_USERMANAGERS) };
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, secGroup, null, null, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("usergroup")) {
        activatePaneInDetailView = "edit.uroles";
        SecurityGroup[] secGroup = { securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS) };
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, secGroup, null, null, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("anonymousgroup")) {
        activatePaneInDetailView = "edit.uroles";
        SecurityGroup[] secGroup = { securityManager.findSecurityGroupByName(Constants.GROUP_ANONYMOUS) };
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, secGroup, null, null, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("userswithoutgroup")) {
        activatePaneInDetailView = "edit.withoutgroup";
        List<Identity> usersWithoutGroup = securityManager.findIdentitiesWithoutBusinessGroup(Identity.STATUS_VISIBLE_LIMIT);
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, usersWithoutGroup, null, true, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("userswithoutemail")) {
        activatePaneInDetailView = "userswithoutemail";
        List<Identity> usersWithoutEmail = userManager.findVisibleIdentitiesWithoutEmail();
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, usersWithoutEmail, null, true, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("usersemailduplicates")) {
        activatePaneInDetailView = "users.email.duplicate";
        List<Identity> usersEmailDuplicates = userManager.findVisibleIdentitiesWithEmailDuplicates();
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, usersEmailDuplicates, null, true, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("logondeniedgroup")) {
        activatePaneInDetailView = "edit.uroles";
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, null, null, null, null, null, Identity.STATUS_LOGIN_DENIED, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("deletedusers")) {
        activatePaneInDetailView = "list.deletedusers";
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, null, null, null, null, null, Identity.STATUS_DELETED, false);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("created.lastweek")) {
        activatePaneInDetailView = null;
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DAY_OF_MONTH, -7);
        Date time = cal.getTime();
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, null, null, null, time, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("created.lastmonth")) {
        activatePaneInDetailView = null;
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MONTH, -1);
        Date time = cal.getTime();
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, null, null, null, time, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("created.sixmonth")) {
        activatePaneInDetailView = null;
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MONTH, -6);
        Date time = cal.getTime();
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, null, null, null, time, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("created.newUsersNotification")) {
        activatePaneInDetailView = null;
        bwControl = addToHistory(ureq, ores, null);
        contentCtr = new NewUsersNotificationsController(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else if (uobject.equals("noauthentication")) {
        activatePaneInDetailView = null;
        String[] auth = { null };
        contentCtr = new UsermanagerUserSearchController(ureq, bwControl, null, null, auth, null, null, Identity.STATUS_VISIBLE_LIMIT, true);
        addToHistory(ureq, bwControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else {
        // to be removed
        throw new AssertException("did not expect to land here in UserAdminMainController this is because uboject is " + uobject.toString());
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) OLATResourceable(org.olat.core.id.OLATResourceable) Calendar(java.util.Calendar) UserCreateController(org.olat.admin.user.UserCreateController) GenericActionExtension(org.olat.core.extensions.action.GenericActionExtension) WindowControl(org.olat.core.gui.control.WindowControl) SecurityGroup(org.olat.basesecurity.SecurityGroup) UserImportController(org.olat.admin.user.imp.UserImportController) Date(java.util.Date) UsermanagerUserSearchController(org.olat.admin.user.UsermanagerUserSearchController) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) List(java.util.List) Identity(org.olat.core.id.Identity) NewUsersNotificationsController(org.olat.admin.user.NewUsersNotificationsController)

Aggregations

SecurityGroup (org.olat.basesecurity.SecurityGroup)142 Identity (org.olat.core.id.Identity)104 ArrayList (java.util.ArrayList)36 Test (org.junit.Test)24 BaseSecurity (org.olat.basesecurity.BaseSecurity)20 User (org.olat.core.id.User)20 CatalogEntry (org.olat.repository.CatalogEntry)18 RepositoryEntry (org.olat.repository.RepositoryEntry)16 Path (javax.ws.rs.Path)14 Date (java.util.Date)12 UserVO (org.olat.user.restapi.UserVO)10 URI (java.net.URI)8 Calendar (java.util.Calendar)8 HashMap (java.util.HashMap)8 HttpResponse (org.apache.http.HttpResponse)8 IdentitiesAddEvent (org.olat.admin.securitygroup.gui.IdentitiesAddEvent)8 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)8 LDAPUser (org.olat.ldap.model.LDAPUser)7 HashSet (java.util.HashSet)6 NamingException (javax.naming.NamingException)6