Package org.olat.basesecurity

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


    }
  }

  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

   * 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

        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

   * @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

   * @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

   * @param selection BitSet
   * @return list of Identities
   */
  protected List<Identity> getSelectedEventParticipants(List<KalendarEvent> dataList, BitSet selection) {
    List<Identity> identities = new ArrayList<Identity>();
    Manager manager = ManagerFactory.getManager();
    for(int i = 0; i < dataList.size(); i++) {
      if(selection.get(i)) {
        String[] parts = dataList.get(i).getParticipants();
        if(parts != null) {
          for(String participant : parts) {
            Identity identity = manager.findIdentityByName(participant);
            if(identity != null)
              identities.add(identity);
          }
        }
      }
View Full Code Here

 
  /**
   * add owners to a set of repository entries
   */
  private void addOwnersToRepositoryEntry() {
    Manager securityManager = ManagerFactory.getManager();
    for (RepositoryEntry entry : repoEntries) {
      SecurityGroup secGroup = entry.getOwnerGroup();
      for (Identity identity : owners) {
        if (!securityManager.isIdentityInSecurityGroup(identity, secGroup)) {
          securityManager.addIdentityToSecurityGroup(identity, secGroup);
        }
      }
    }
    // info message
    getWindowControl().setInfo(translator.translate("info.message.add.owners"));
View Full Code Here

   */
  private SystemRolesAndRightsForm createForm(UserRequest ureq, Identity identity) {
    Map configuration = BaseSecurityModule.getConfiguration();
    boolean iAmOlatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
   
    Manager secMgr = ManagerFactory.getManager();
    // get user system roles groups from security manager
    SecurityGroup adminGroup = secMgr.findSecurityGroupByName(Constants.GROUP_ADMIN);
    boolean isAdmin = secMgr.isIdentityInSecurityGroup(identity, adminGroup);
   
    SecurityGroup userManagerGroup = secMgr.findSecurityGroupByName(Constants.GROUP_USERMANAGERS);
    boolean isUserManager = secMgr.isIdentityInSecurityGroup(identity, userManagerGroup);

    SecurityGroup authorGroup = secMgr.findSecurityGroupByName(Constants.GROUP_AUTHORS);
    boolean isAuthor = secMgr.isIdentityInSecurityGroup(identity, authorGroup);
 
    SecurityGroup groupmanagerGroup = secMgr.findSecurityGroupByName(Constants.GROUP_GROUPMANAGERS);
    boolean isGroupManager = secMgr.isIdentityInSecurityGroup(identity, groupmanagerGroup);

    SecurityGroup isAnonymous = secMgr.findSecurityGroupByName(Constants.GROUP_ANONYMOUS);
    boolean isGuestOnly = secMgr.isIdentityInSecurityGroup(identity, isAnonymous);
   
    SecurityGroup institutionalResourceManager = secMgr.findSecurityGroupByName(Constants.GROUP_INST_ORES_MANAGER);
    boolean isInstitutionalResourceManager = secMgr.isIdentityInSecurityGroup(identity, institutionalResourceManager);
   
    // create new form and init with users values
    SystemRolesAndRightsForm form = new SystemRolesAndRightsForm("sysRightsForm", translator, identity.getUser().getProperty("institutionalName", null));
   
    // check if user is allowed to manipulate field, otherwhise set to be not used
View Full Code Here

    translator = new PackageTranslator(PACKAGE, ureq.getLocale());
    Roles roles = ureq.getUserSession().getRoles();
   
    vc = new VelocityContainer("reposearch", VELOCITY_ROOT + "/search.html", translator, this);
   
    Manager secMgr = ManagerFactory.getManager();
    SecurityGroup usermanagerGroup = secMgr.findSecurityGroupByName(Constants.GROUP_USERMANAGERS);
    boolean isUserManager = secMgr.isIdentityInSecurityGroup(ureq.getIdentity(), usermanagerGroup);

    searchForm = new SearchForm("searchform", translator, withCancel, isUserManager||roles.isOLATAdmin(), limitType, limitUser);
    searchForm.addListener(this);
    searchForm.setVisible(false);
    vc.put("searchform",searchForm);
View Full Code Here

TOP

Related Classes of org.olat.basesecurity.Manager

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.