Package org.olat.basesecurity

Examples of org.olat.basesecurity.Manager


   * @param wControl
   */
  public QuotaController(UserRequest ureq, WindowControl wControl) {
    super(ureq, wControl);

    Manager mgr = ManagerFactory.getManager();
    if (!mgr.isIdentityPermittedOnResourceable(
        ureq.getIdentity(),
        Constants.PERMISSION_ACCESS,
        OresHelper.lookupType(this.getClass())))
      throw new OLATSecurityException("Insufficient permissions to access QuotaController");

View Full Code Here


   
    putInitialPanel(myContent);
  }

  private void initMyContent(UserRequest ureq) {
    Manager mgr = ManagerFactory.getManager();
    if (!mgr.isIdentityPermittedOnResourceable(
        ureq.getIdentity(),
        Constants.PERMISSION_ACCESS,
        OresHelper.lookupType(this.getClass())))
      throw new OLATSecurityException("Insufficient permissions to access QuotaController");
View Full Code Here

    BusinessGroupPropertyManager bgpm = new BusinessGroupPropertyManager(businessGroup);
    this.showChooseOwners = bgpm.showOwners();
    this.showChoosePartips = bgpm.showPartips();
    this.isAdmin = isAdmin;
   
    Manager scrtMngr = ManagerFactory.getManager();
    VisibilityDependsOnSelectionRule rule;
   
    if (!isRightGroup()) {
      if (isMultiSelectionOwnerKeys()) {
        String[] radioKeysOwners = { NLS_RADIO_ALL, NLS_RADIO_NOTHING, NLS_RADIO_CHOOSE };
        String[] radioValuesOwners = { translator.translate("sendtochooser.form.radio.owners.all"),
            translator.translate("sendtochooser.form.radio.owners.nothing"), translator.translate("sendtochooser.form.radio.owners.choose") };
        radioButtonOwner = new RadioButtonGroupElement(true, "sendtochooser.form.radio.owners", radioKeysOwners, radioValuesOwners);
        radioButtonOwner.select(NLS_RADIO_ALL, true);

        // Owner MultiSelection
        SecurityGroup owners = businessGroup.getOwnerGroup();
        List<Identity> ownerList = scrtMngr.getIdentitiesOfSecurityGroup(owners);
        String[] keysOwner = new String[ownerList.size()];
        String[] valuesOwner = new String[ownerList.size()];
        for (int i = 0; i < ownerList.size(); i++) {
          keysOwner[i] = ownerList.get(i).getKey().toString();
          valuesOwner[i] = ownerList.get(i).getName().toString();
        }
        multiSelectionOwnerKeys = new StaticMultipleSelectionElement(null, keysOwner, valuesOwner, ownerList.size() > 0 ? true : false);

        addFormElement("radioButtonOwner", radioButtonOwner);
        addFormElement("multiSelectionOwnerKeys", multiSelectionOwnerKeys);

        // rule owner
        rule = new VisibilityDependsOnSelectionRule(radioButtonOwner, multiSelectionOwnerKeys, "choose", true, null, true);
        addVisibilityDependsOnSelectionRule(rule);
      } else {
        String[] radioKeysOwners = { NLS_RADIO_ALL, NLS_RADIO_NOTHING };
        String[] radioValuesOwners = { translator.translate("sendtochooser.form.radio.owners.all"),
            translator.translate("sendtochooser.form.radio.owners.nothing") };
        radioButtonOwner = new RadioButtonGroupElement(true, "sendtochooser.form.radio.owners", radioKeysOwners, radioValuesOwners);
        radioButtonOwner.select(NLS_RADIO_ALL, true);

        addFormElement("radioButtonOwner", radioButtonOwner);
      }
    }
    if (isMultiSelectionPartipKeys()) {
      if (isRightGroup()) {
        String[] radioKeysPartip = { NLS_RADIO_ALL, NLS_RADIO_CHOOSE };
        String[] radioValuesPartip = { translator.translate("sendtochooser.form.radio.partip.rightgroup.all"), translator.translate("sendtochooser.form.radio.partip.rightgroup.choose") };
        radioButtonPartip = new RadioButtonGroupElement(true, "sendtochooser.form.radio.rightgroup", radioKeysPartip, radioValuesPartip);
        radioButtonPartip.select(NLS_RADIO_ALL, true);
        // Participator MultiSelection
        SecurityGroup participants = businessGroup.getPartipiciantGroup();
        List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
        String[] keysPartip = new String[participantsList.size()];
        String[] valuesPartip = new String[participantsList.size()];
        for (int i = 0; i < participantsList.size(); i++) {
          keysPartip[i] = participantsList.get(i).getKey().toString();
          valuesPartip[i] = participantsList.get(i).getName().toString();
        }
        multiSelectionPartipKeys = new StaticMultipleSelectionElement(null, keysPartip, valuesPartip, participantsList.size() > 0 ? true
            : false);
        addFormElement("radioButtonPartip", radioButtonPartip);
        addFormElement("multiSelectionPartipKeys", multiSelectionPartipKeys);
        // rule partips
        rule = new VisibilityDependsOnSelectionRule(radioButtonPartip, multiSelectionPartipKeys, "choose", true, null, true);
        addVisibilityDependsOnSelectionRule(rule);
      } else {
        String[] radioKeysPartip = { NLS_RADIO_ALL, NLS_RADIO_NOTHING, NLS_RADIO_CHOOSE };
        String[] radioValuesPartip = { translator.translate("sendtochooser.form.radio.partip.all"),
            translator.translate("sendtochooser.form.radio.partip.nothing"), translator.translate("sendtochooser.form.radio.partip.choose") };
        radioButtonPartip = new RadioButtonGroupElement(true, "sendtochooser.form.radio.partip", radioKeysPartip, radioValuesPartip);
        radioButtonPartip.select(NLS_RADIO_ALL, true);
        // Participator MultiSelection
        SecurityGroup participants = businessGroup.getPartipiciantGroup();
        List<Identity> participantsList = scrtMngr.getIdentitiesOfSecurityGroup(participants);
        String[] keysPartip = new String[participantsList.size()];
        String[] valuesPartip = new String[participantsList.size()];
        for (int i = 0; i < participantsList.size(); i++) {
          keysPartip[i] = participantsList.get(i).getKey().toString();
          valuesPartip[i] = participantsList.get(i).getName().toString();
        }
        multiSelectionPartipKeys = new StaticMultipleSelectionElement(null, keysPartip, valuesPartip, participantsList.size() > 0 ? true
            : false);
        addFormElement("radioButtonPartip", radioButtonPartip);
        addFormElement("multiSelectionPartipKeys", multiSelectionPartipKeys);
        // rule partips
        rule = new VisibilityDependsOnSelectionRule(radioButtonPartip, multiSelectionPartipKeys, "choose", true, null, true);
        addVisibilityDependsOnSelectionRule(rule);
      }
    } else {
      if (isRightGroup()) {
        String[] radioKeysPartip = { NLS_RADIO_ALL };
        String[] radioValuesPartip = { translator.translate("sendtochooser.form.radio.partip.all.rightgroup") };
        radioButtonPartip = new RadioButtonGroupElement(true, "sendtochooser.form.radio.partip.rightgroup", radioKeysPartip, radioValuesPartip);
        radioButtonPartip.select(NLS_RADIO_ALL, true);
        addFormElement("radioButtonPartip", radioButtonPartip);
      } else {
        String[] radioKeysPartip = { NLS_RADIO_ALL, NLS_RADIO_NOTHING };
        String[] radioValuesPartip = { translator.translate("sendtochooser.form.radio.partip.all"),
            translator.translate("sendtochooser.form.radio.partip.nothing") };
        radioButtonPartip = new RadioButtonGroupElement(true, "sendtochooser.form.radio.partip", radioKeysPartip, radioValuesPartip);
        radioButtonPartip.select(NLS_RADIO_ALL, true);
        addFormElement("radioButtonPartip", radioButtonPartip);
      }
    }   

    if ( isAdmin && businessGroup.getWaitingListEnabled().booleanValue()) {
      String[] radioKeysWaitings = { NLS_RADIO_ALL, NLS_RADIO_NOTHING, NLS_RADIO_CHOOSE };
      String[] radioValuesWaitings = {translator.translate("sendtochooser.form.radio.waitings.all"), translator.translate("sendtochooser.form.radio.waitings.nothing"), translator.translate("sendtochooser.form.radio.waitings.choose")};
      radioButtonWaiting = new RadioButtonGroupElement(true, "sendtochooser.form.radio.waitings", radioKeysWaitings, radioValuesWaitings);
      radioButtonWaiting.select(NLS_RADIO_ALL, true);
     
      // Waitings MultiSelection
      SecurityGroup waitingList = businessGroup.getWaitingGroup();
      List<Identity> waitingListIdentities = scrtMngr.getIdentitiesOfSecurityGroup(waitingList);
      String[] keysWaiting = new String[waitingListIdentities.size()];
      String[] valuesWaiting = new String[waitingListIdentities.size()];
      for (int i = 0; i < waitingListIdentities.size(); i++) {
        keysWaiting[i] = waitingListIdentities.get(i).getKey().toString();
        valuesWaiting[i] = waitingListIdentities.get(i).getName().toString();
View Full Code Here

  @Override
  protected void formOK(UserRequest ureq) {
    //list with property-key-name and value for the MailTemplate in the next step
    List<String[]> propsAndValues = new ArrayList<String[]>(userPropertyHandlers.size());
    //
    Manager im = ManagerFactory.getManager();
    Identity identity = im.findIdentityByName(getIdentity().getName());
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
      String propertyName = userPropertyHandler.getName();
      FormItem fi = this.flc.getFormComponent(propertyName);
      String propertyValue = userPropertyHandler.getStringValue(fi);
      //(propertyname, propertyvalue) for mailtemplate
View Full Code Here

   * do unsubscribe all group members from this course
   */
  private void doCleanGroups(Identity identity) {
    ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource());
    if(course != null) {
      Manager securityManager = ManagerFactory.getManager();
      SecurityGroup secGroupOwner = null;
      SecurityGroup secGroupPartipiciant = null;
      SecurityGroup secGroupWaiting = null;
      // LearningGroups
      List allGroups = course.getCourseEnvironment().getCourseGroupManager().getAllLearningGroupsFromAllContexts();
      BGConfigFlags flagsLearning = BGConfigFlags.createLearningGroupDefaultFlags();
      for (Object bGroup : allGroups) {
        secGroupOwner = ((BusinessGroup) bGroup).getOwnerGroup();
        secGroupPartipiciant = ((BusinessGroup) bGroup).getPartipiciantGroup();
        BusinessGroupManagerImpl.getInstance().removeOwnersAndFireEvent(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupOwner), ((BusinessGroup) bGroup), flagsLearning);
        BusinessGroupManagerImpl.getInstance().removeParticipantsAndFireEvent(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupPartipiciant), ((BusinessGroup) bGroup), flagsLearning);
        if(((BusinessGroup) bGroup).getWaitingListEnabled()) {
          secGroupWaiting = ((BusinessGroup) bGroup).getWaitingGroup();
          BusinessGroupManagerImpl.getInstance().removeFromWaitingListAndFireEvent(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupWaiting), ((BusinessGroup) bGroup), flagsLearning);
        }
      }
      // RightGroups
      allGroups.clear();
      allGroups = course.getCourseEnvironment().getCourseGroupManager().getAllRightGroupsFromAllContexts();
      BGConfigFlags flagsRightgroup = BGConfigFlags.createRightGroupDefaultFlags();
      for (Object bGroup : allGroups) {
        secGroupPartipiciant = ((BusinessGroup) bGroup).getPartipiciantGroup();
        BusinessGroupManagerImpl.getInstance().removeParticipantsAndFireEvent(identity, securityManager.getIdentitiesOfSecurityGroup(secGroupPartipiciant), ((BusinessGroup) bGroup), flagsRightgroup);
      }
    }
  }
View Full Code Here

  }

  private ContactList[] retrieveGroups(String csvGroups) {
    CourseGroupManager cgm = this.userCourseEnv.getCourseEnvironment().getCourseGroupManager();
    Manager secManager = ManagerFactory.getManager();
    List<String> groupNames = splitNames(csvGroups);
    List<ContactList> groupsCL = new ArrayList<ContactList>();
    /*
     * for each group name in all the course's group contexts get the
     * participants groups. From the resulting groups take all participants and
     * add the identities to the ContactList named like the group.
     */
    Iterator<String> iterator = groupNames.iterator();
    while (iterator.hasNext()) {
      // fetch all participants and owners by getting all participants and
      // owners of all groups
      String groupName = iterator.next();
      List<BusinessGroup> mygroups = cgm.getLearningGroupsFromAllContexts(groupName);
      // create a ContactList with the name of the group
      ContactList tmp = new ContactList(groupName);
      for (int i = 0; i < mygroups.size(); i++) {
        BusinessGroup bg = mygroups.get(i);
        List<Identity> ids = secManager.getIdentitiesOfSecurityGroup(bg.getPartipiciantGroup());
        ids.addAll(secManager.getIdentitiesOfSecurityGroup(bg.getOwnerGroup()));
        // add all identities to the ContactList
        tmp.addAllIdentites(ids);
      }
      // add the ContactList
      groupsCL.add(tmp);
View Full Code Here

    return retVal;
  }

  private ContactList[] retrieveAreas(String csvAreas) {
    CourseGroupManager cgm = this.userCourseEnv.getCourseEnvironment().getCourseGroupManager();
    Manager secManager = ManagerFactory.getManager();
    List<String> areaNames = splitNames(csvAreas);
    List<ContactList> groupsCL = new ArrayList<ContactList>();
    /*
     * for each area name in all the course's group contexts get the
     * participants groups. From the resulting groups take all participants and
     * add the identities to the ContactList named like the group.
     */
    Iterator<String> iterator = areaNames.iterator();
    while (iterator.hasNext()) {
      // fetch all participants and owners by getting all participants and
      // owners of all groups
      String areaName = iterator.next();
      List<BusinessGroup> mygroups = cgm.getLearningGroupsInAreaFromAllContexts(areaName);
      // create a ContactList with the name of the group
      ContactList tmp = new ContactList(areaName);
      for (int i = 0; i < mygroups.size(); i++) {
        BusinessGroup bg = mygroups.get(i);
        List<Identity> ids = secManager.getIdentitiesOfSecurityGroup(bg.getPartipiciantGroup());
        ids.addAll(secManager.getIdentitiesOfSecurityGroup(bg.getOwnerGroup()));
        // add all identities to the ContactList
        tmp.addAllIdentites(ids);
      }
      // add the ContactList
      groupsCL.add(tmp);
View Full Code Here

      ManagerFactory.getManager().deleteAuthentication(auth);
      Tracing.logInfo("Delete auth=" + auth + "  of identity="  + identity, this.getClass());
    }
   
    //remove identity from its security groups
    Manager secMgr = ManagerFactory.getManager();
    List<SecurityGroup> securityGroups = ManagerFactory.getManager().getSecurityGroupsForIdentity(identity);
    for (SecurityGroup secGroup : securityGroups) {
      secMgr.removeIdentityFromSecurityGroup(identity, secGroup);
      Tracing.logInfo("Removing user=" + identity + " from security group="  + secGroup.toString(), this.getClass());
    }
   
    // can be used, if there is once the possibility to delete identities without db-constraints...
    //if neither email nor login should be kept, REALLY DELETE Identity
View Full Code Here

      formLayout.add(innerFormLayout);

      // check user rights:
      boolean iAmOlatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
      identity = ureq.getIdentity();
      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);

      // usermanager:
      if (isAdmin || isUserManager || iAmOlatAdmin) {
        chkUserManager = uifactory.addCheckboxesVertical("Usermanager", "table.role.useradmin", innerFormLayout, new String[] { "Usermanager" }, new String[] { "" }, null, 1);
        chkUserManager.select("Usermanager", false);
View Full Code Here

     * @param securityGroup
     * @param roleChangeMap
     * @return
     */
    private String getRoleStatusForIdentity(Identity identity, String securityGroup, HashMap<String, String> roleChangeMap) {
      Manager secMgr = ManagerFactory.getManager();
      SecurityGroup secGroup = secMgr.findSecurityGroupByName(securityGroup);
      Boolean isInGroup = secMgr.isIdentityInSecurityGroup(identity, secGroup);

      String thisRoleAction = "";
      if (roleChangeMap.containsKey(securityGroup)) {
        thisRoleAction = roleChangeMap.get(securityGroup);
      } else return isInGroup.toString();
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.