Examples of Manager


Examples of org.olat.basesecurity.Manager

  /**
   * @return List of identities that match the criterias from the search form
   */
  private List<Identity> findIdentitiesFromSearchForm() {
    Manager secMgr = ManagerFactory.getManager();
    // get user attributes from form
    String login = searchform.getTextElement("login").getValue();
    Integer status = null;

    // get user fields from form
    // build user fields search map
    Map<String, String> userPropertiesSearch = new HashMap<String, String>();
    for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
      if (userPropertyHandler == null) continue;
      FormElement ui = searchform.getFormElement(userPropertyHandler.getName());
      String uiValue = userPropertyHandler.getStringValue(ui);
      if (StringHelper.containsNonWhitespace(uiValue)) {
        userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
      }
    }
    if (userPropertiesSearch.isEmpty()) userPropertiesSearch = null;

    // get group memberships from form
    List<SecurityGroup> groupsList = new ArrayList<SecurityGroup>();
    if (searchform.getCheckBoxElement("admin") != null && searchform.getCheckBoxElement("admin").isChecked()) {
      SecurityGroup group = secMgr.findSecurityGroupByName(org.olat.basesecurity.Constants.GROUP_ADMIN);
      groupsList.add(group);
    }
    if (searchform.getCheckBoxElement("author") != null && searchform.getCheckBoxElement("author").isChecked()) {
      SecurityGroup group = secMgr.findSecurityGroupByName(org.olat.basesecurity.Constants.GROUP_AUTHORS);
      groupsList.add(group);
    }
    if (searchform.getCheckBoxElement("groupmanager") != null && searchform.getCheckBoxElement("groupmanager").isChecked()) {
      SecurityGroup group = secMgr.findSecurityGroupByName(org.olat.basesecurity.Constants.GROUP_GROUPMANAGERS);
      groupsList.add(group);
    }
    if (searchform.getCheckBoxElement("usermanager") != null && searchform.getCheckBoxElement("usermanager").isChecked()) {
      SecurityGroup group = secMgr.findSecurityGroupByName(org.olat.basesecurity.Constants.GROUP_USERMANAGERS);
      groupsList.add(group);
    }
    if (searchform.getCheckBoxElement("oresmanager") != null && searchform.getCheckBoxElement("oresmanager").isChecked()) {
      SecurityGroup group = secMgr.findSecurityGroupByName(org.olat.basesecurity.Constants.GROUP_INST_ORES_MANAGER);
      groupsList.add(group);
    }
    if (searchform.getSingleSelectionElement("status") != null) {
      status = new Integer(searchform.getSingleSelectionElement("status").getSelectedKey());
    }
    SecurityGroup[] groups = groupsList.toArray(new SecurityGroup[groupsList.size()]);

    // no permissions in this form so far
    PermissionOnResourceable[] permissionOnResources = null;

    // get selected authentication providers from list
    List<String> authProvidersList = new ArrayList<String>();
    // get all authentication provider from configuration
    Collection providers = LoginModule.getAuthenticationProviders();
    Iterator iter = providers.iterator();
    while (iter.hasNext()) {
      AuthenticationProvider provider = (AuthenticationProvider) iter.next();
      if (provider.isEnabled()) {
        String providerName = provider.getName();
        CheckBoxElement authElem = searchform.getCheckBoxElement("auth." + providerName);
        if (authElem != null && authElem.isChecked()) {
          authProvidersList.add(providerName);
        }
      }
    }
   
    if(WebDAVManager.getInstance().isEnabled()) {
      CheckBoxElement authElem = searchform.getCheckBoxElement("auth." + WebDAVAuthManager.PROVIDER_WEBDAV);
      if (authElem != null && authElem.isChecked()) {
        authProvidersList.add(WebDAVAuthManager.PROVIDER_WEBDAV);
      }
    }
   
    // add null provider as special case
    if (searchform.getCheckBoxElement("admin") != null && searchform.getCheckBoxElement("noAuth").isChecked()) {
      authProvidersList.add(null);
    }
    String[] authProviders = (String[]) authProvidersList.toArray(new String[authProvidersList.size()]);

    // get date constraints from form
    Date createdBefore = searchform.getDateElement("beforeDate").getDate();
    Date createdAfter = searchform.getDateElement("afterDate").getDate();

    // now perform power search
    List<Identity> myIdentities = secMgr.getIdentitiesByPowerSearch((login.equals("") ? null : login), userPropertiesSearch, true, groups,
        permissionOnResources, authProviders, createdAfter, createdBefore, status);

    return myIdentities;
  }
View Full Code Here

Examples of org.olat.basesecurity.Manager

   * no other owner are found the user won't be removed from the owner group
   *
   * @param ureq
   */
  private void doBuddyGroupLeave(UserRequest ureq) {
    Manager securityManager = ManagerFactory.getManager();
    BGConfigFlags flags = BGConfigFlags.createBuddyGroupDefaultFlags();
    // 1) remove as owner
    SecurityGroup owners = currBusinessGroup.getOwnerGroup();
    if (securityManager.isIdentityInSecurityGroup(identity, owners)) {
      List ownerList = securityManager.getIdentitiesOfSecurityGroup(owners);
      if (ownerList.size() > 1) {
        bgm.removeOwnerAndFireEvent(ureq.getIdentity(), ureq.getIdentity(), currBusinessGroup, flags, false);
        // update model
        updateGroupListModelAll();
      } else {
View Full Code Here

Examples of org.olat.basesecurity.Manager

   *
   * @param ureq
   */
  private void reloadDataModel(UserRequest ureq) {
    if (identitiesList == null) return;
    Manager secMgr = ManagerFactory.getManager();
    for (int i = 0; i < identitiesList.size(); i++) {
      Identity ident = identitiesList.get(i);
      Identity refrshed = secMgr.loadIdentityByKey(ident.getKey());
      identitiesList.set(i, refrshed);
    }
    initUserListCtr(ureq, identitiesList, null);
    userListVC.put("userlist", tableCtr.getInitialComponent());
  }
View Full Code Here

Examples of org.olat.basesecurity.Manager

    // initialize all velocity containers
    initVC();

    // check if user is owner of this group context
    Manager securityManager = ManagerFactory.getManager();
    this.isContextOwner = securityManager.isIdentityInSecurityGroup(ureq.getIdentity(), this.bgContext.getOwnerGroup());

    // Layout is controlled with generic controller: menu - content - tools
    // Navigation menu
    olatMenuTree = new MenuTree("olatMenuTree");
    TreeModel tm = buildTreeModel(ureq);
View Full Code Here

Examples of org.olat.basesecurity.Manager

    }
  }

  private void doGroupMessage(UserRequest ureq) {
    List list = new ArrayList();
    Manager securityManager = ManagerFactory.getManager();
    list.addAll(securityManager.getIdentitiesOfSecurityGroup(currentGroup.getPartipiciantGroup()));
    if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) list
        .addAll(securityManager.getIdentitiesOfSecurityGroup(currentGroup.getOwnerGroup()));
    // right group has a different groupname in the to field.
    String groupMailToName;
    if (flags.isEnabled(BGConfigFlags.RIGHTS)) groupMailToName = translate("rightgroup.message.to");
    else groupMailToName = translate("group.message.to");
    doContactForm(ureq);
View Full Code Here

Examples of org.olat.basesecurity.Manager

   * generates the email adress list.
   * @param ureq
   * @return a contact form controller for this group
   */
  private ContactFormController createContactFormController(UserRequest ureq) {
    Manager scrtMngr = ManagerFactory.getManager();

    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    // two named ContactLists, the new way using the contact form
    // the same name as in the checkboxes are taken as contactlist names
    ContactList ownerCntctLst = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.owners"));
    ContactList partipCntctLst = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.partip"));
    ContactList waitingListContactList = new ContactList(businessGroupTranslator.translate("sendtochooser.form.chckbx.waitingList"));
    if (flags.isEnabled(BGConfigFlags.GROUP_OWNERS)) {
      if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup owners = this.currentGroup.getOwnerGroup();
        List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
        ownerCntctLst.addAllIdentites(ownerList);
        cmsg.addEmailTo(ownerCntctLst);
      } else {
        if (sendToChooserForm.ownerChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup owners = this.currentGroup.getOwnerGroup();
          List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
          for (Identity identity : new ArrayList<Identity>(ownerList)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedOwnerKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              ownerList.remove(identity);
            }
          }
          ownerCntctLst.addAllIdentites(ownerList);
          cmsg.addEmailTo(ownerCntctLst);
        }
      }
    }
    if (sendToChooserForm != null) {
      if  (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup participants = this.currentGroup.getPartipiciantGroup();
        List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
        partipCntctLst.addAllIdentites(participantsList);
        cmsg.addEmailTo(partipCntctLst);
      } else {
        if (sendToChooserForm.participantChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup participants = this.currentGroup.getPartipiciantGroup();
          List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
          for (Identity identity : new ArrayList<Identity>(participantsList)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedPartipKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
                break;
              }
            }
            if (!keyIsSelected) {
              participantsList.remove(identity);
            }
          }
          partipCntctLst.addAllIdentites(participantsList);
          cmsg.addEmailTo(partipCntctLst);
        }
      }
     
    }
    if (sendToChooserForm != null && getIsGMAdminOwner(ureq) && this.currentGroup.getWaitingListEnabled().booleanValue()) {
      if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_ALL)) {
        SecurityGroup waitingList = this.currentGroup.getWaitingGroup();
        List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
        waitingListContactList.addAllIdentites(waitingListIdentities);
        cmsg.addEmailTo(waitingListContactList);
      } else {
        if (sendToChooserForm.waitingListChecked().equals(BusinessGroupSendToChooserForm.NLS_RADIO_CHOOSE)) {
          SecurityGroup waitingList = this.currentGroup.getWaitingGroup();
          List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
          for (Identity identity : new ArrayList<Identity>(waitingListIdentities)) {
            boolean keyIsSelected = false;
            for (Long key : sendToChooserForm.getSelectedWaitingKeys()) {
              if (key.equals(identity.getKey())) {
                keyIsSelected = true;
View Full Code Here

Examples of org.olat.basesecurity.Manager

        back6 = LinkFactory.createLinkBack(step6VC, this);
       
        GenericObjectArrayTableDataModel feedbackDataModel = new GenericObjectArrayTableDataModel(rowsFeedbackStep, numOfLines);
       
        UserManager um = UserManager.getInstance();
        Manager secMgr = ManagerFactory.getManager();
       
        BulkActionModule bam = new BulkActionModule();
        BulkAction ba = (BulkAction) bulkActions.get(bulkType);

        // TODO: as:b may be add additional class hierarchy (ask pb !!!)
        if ((ba instanceof BulkActionSetNodeScore)){
          ((BulkActionSetNodeScore) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }else if ((ba instanceof BulkActionSetNodePassed)){
          ((BulkActionSetNodePassed) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }else if ((ba instanceof BulkActionSetNodeUserComment)){
          ((BulkActionSetNodeUserComment) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }
       
        List identitiesAndTheirAssessments = new ArrayList(feedbackDataModel.getRowCount());
        // read values from the column which the user has defined as olat key (e.g. username)
        // and add them to a list.
        for(int i = 0; i < feedbackDataModel.getRowCount(); i ++ ){
          String val = (String) feedbackDataModel.getValueAt(i, selectedColForOlatKey);
          val = val.trim();
          String assessment = (String) feedbackDataModel.getValueAt(i, colForBulk);
          Identity identity = null;

          if (selectedOlatKey == 0){ // username
              identity = secMgr.findIdentityByName(val);
          }else if (selectedOlatKey == 1) { // email
            identity = um.findIdentityByEmail(val);
          }
          identitiesAndTheirAssessments.add(new Object[]{identity,assessment});
        }
View Full Code Here

Examples of org.olat.basesecurity.Manager

   * @param newEvent
   */
  private void addDateInUserCalendar(KalendarEvent newEvent) {
    String[] participants = newEvent.getParticipants();
    if(participants == null) return;//no users to update, cancel
    Manager manager = ManagerFactory.getManager();
    for( String participant : participants ) {
      Identity identity = manager.findIdentityByName(participant);
      Kalendar userCal = calManager.getPersonalCalendar(identity).getKalendar();
      Collection<KalendarEvent> userEvents = new ArrayList<KalendarEvent>();
      userEvents.addAll(userCal.getEvents());
      KalendarEvent userNewEvent = new KalendarEvent(CodeHelper.getGlobalForeverUniqueID(), newEvent.getSubject(), newEvent.getBegin(), newEvent.getEnd());
      userNewEvent.setLocation(newEvent.getLocation());
View Full Code Here

Examples of org.olat.basesecurity.Manager

   * @param oldEvent
   */
  private void removeDateInUserCalendar(KalendarEvent oldEvent) {
    String[] participants = oldEvent.getParticipants();
    if(participants == null) return;//no users to update, cancel
    Manager manager = ManagerFactory.getManager();
    for( String participant : participants ) {
      Identity identity = manager.findIdentityByName(participant);
      Kalendar userCal = calManager.getPersonalCalendar(identity).getKalendar();
      Collection<KalendarEvent> userEvents = new ArrayList<KalendarEvent>();
      userEvents.addAll(userCal.getEvents());
      for( KalendarEvent userEvent : userEvents ) {
        String sourceNodeId = userEvent.getSourceNodeId();
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.Manager

  {
    // all is settled now, proxy should have prefix file pulled from remote AND merged with cache content
    final MavenProxyRepository proxyRepository =
        getRepositoryRegistry().getRepositoryWithFacet(PROXY_REPO_ID, MavenProxyRepository.class);

    final Manager routingManager = lookup(Manager.class);
    final PrefixSource proxyPrefixSource = routingManager.getPrefixSourceFor(proxyRepository);

    assertThat("Prefix file for proxy repository should exists", proxyPrefixSource.exists());
    assertThat("Prefix file for proxy repository should be discovered", proxyPrefixSource.supported());
    assertThat("Prefix file should be instanceof FilePrefixSource", proxyPrefixSource instanceof FilePrefixSource);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.