Examples of Manager


Examples of org.olat.basesecurity.Manager

   */
  public void event(UserRequest ureq, Component source, Event event) {
    if (source == regForm) {
      if (event == Form.EVNT_VALIDATION_OK) {
        String choosenLogin = regForm.getLogin();
        Manager secMgr = ManagerFactory.getManager();
        Identity identity = secMgr.findIdentityByName(choosenLogin);

       
        if (identity == null) { // ok, create new user
          if (!hasEmailInShibAttr){
            regWithEmailForm = new ShibbolethRegistrationWithEmailForm("regWithEmailForm", translator, choosenLogin);
            regWithEmailForm.addListener(this);
            mainContainer.put("regWithEmailForm", regWithEmailForm);
            mainContainer.setPage(VELOCITY_ROOT + "/registerwithemail.html");
          } else { // there is an emailaddress
            state = STATE_NEW_SHIB_USER;
            mainContainer.setPage(VELOCITY_ROOT + "/disclaimer.html");
          }
        } else { // offer identity migration, if OLAT provider exists
          Authentication auth = secMgr.findAuthentication(identity, OLATAuthenticationController.PROVIDER_OLAT);         
          if (auth == null) { // no OLAT provider, migration not possible...
            getWindowControl().setError(translator.translate("sr.error.loginexists", new String[] {WebappHelper.getMailConfig("mailSupport")}));
          else { // OLAT provider exists, offer migration...
            migrationForm = new ShibbolethMigrationForm("migrationForm", translator, auth);
            migrationForm.addListener(this);
View Full Code Here

Examples of org.olat.basesecurity.Manager

        dclController.changeLocale(lcev.getNewLocale());
      }
    } else if (source == dclController) {
      if (event == Event.DONE_EVENT) { // disclaimer accepted...
        if (state == STATE_NEW_SHIB_USER) { // ...proceed and create user
          Manager secMgr = ManagerFactory.getManager();
          String choosenLogin = regForm.getLogin();
          // check if login has been taken by another user in the meantime...
          Identity identity = secMgr.findIdentityByName(choosenLogin);
          if (identity != null) {
            getWindowControl().setError(translator.translate("sr.login.meantimetaken"));
            mainContainer.setPage(VELOCITY_ROOT + "/register.html");
            state = STATE_UNDEFINED;
            return;
          }

          String email;
          if(!hasEmailInShibAttr) email = regWithEmailForm.getEmail();
          else email = userMapping.getEMail();
          User user = UserManager.getInstance().findUserByEmail(email);
         
          if (user != null) {
            // error, email already exists. should actually not happen if OLAT Authenticator has
            // been set after removing shibboleth authenticator
            getWindowControl().setError(translator.translate("sr.error.emailexists", new String[] {WebappHelper.getMailConfig("mailSupport")}));
            mainContainer.setPage(VELOCITY_ROOT + "/register.html");
            state = STATE_UNDEFINED;
            return;
          }

          String firstName = userMapping.getFirstName();
          String lastName = userMapping.getLastName();
          user = UserManager.getInstance().createUser(firstName, lastName, email);
          user.setProperty(UserConstants.INSTITUTIONALNAME, userMapping.getInstitutionalName());
          if(hasEmailInShibAttr){
            user.setProperty(UserConstants.INSTITUTIONALEMAIL, userMapping.getInstitutionalEMail());
          }
          user.setProperty(UserConstants.INSTITUTIONALUSERIDENTIFIER, userMapping.getInstitutionalUserIdentifier());
          identity = secMgr.createAndPersistIdentityAndUser(choosenLogin, user, ShibbolethDispatcher.PROVIDER_SHIB, shibbolethUniqueID, null);
          SecurityGroup olatUserGroup = secMgr.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
          secMgr.addIdentityToSecurityGroup(identity, olatUserGroup);
          // tell system that this user did accept the disclaimer
          RegistrationManager.getInstance().setHasConfirmedDislaimer(identity);
          doLogin(identity, ureq);
          return;
        } else if (state == STATE_MIGRATED_SHIB_USER) { // ...proceed and migrate user
          // create additional authentication
          Authentication auth = migrationForm.getAuthentication();
          Identity authenticationedIdentity = auth.getIdentity();
          Manager secMgr = ManagerFactory.getManager();
          secMgr.createAndPersistAuthentication(authenticationedIdentity, ShibbolethDispatcher.PROVIDER_SHIB, shibbolethUniqueID, null);
         
          // update user profile
          User user = authenticationedIdentity.getUser();
          String s = userMapping.getFirstName();
          if (s != null) user.setProperty(UserConstants.FIRSTNAME, s);
View Full Code Here

Examples of org.olat.basesecurity.Manager

    this.currBusinessGroup.setMaxParticipants(bgMax);
    this.currBusinessGroup.setMinParticipants(bgMin);
    this.currBusinessGroup.setWaitingListEnabled(waitingListEnabled);
    if (waitingListEnabled.booleanValue() && (this.currBusinessGroup.getWaitingGroup() == null) ) {
      // Waitinglist is enabled but not created => Create waitingGroup
      Manager securityManager = ManagerFactory.getManager();
      SecurityGroup waitingGroup = securityManager.createAndPersistSecurityGroup();
      currBusinessGroup.setWaitingGroup(waitingGroup);
    }
    currBusinessGroup.setAutoCloseRanksEnabled(autoCloseRanksEnabled);
    currBusinessGroup.setLastUsage(new Date(System.currentTimeMillis()));
    LifeCycleManager.createInstanceFor(currBusinessGroup).deleteTimestampFor(GroupDeletionManager.SEND_DELETE_EMAIL_ACTION);
View Full Code Here

Examples of org.olat.basesecurity.Manager

     * groups...................................................... [3] create 2
     * policies, ownerGroup -> PERMISSION_ACCESS -> buddygroup.
     * ....partipiciantGroup -> PERMISSION_READ -> buddygroup ..............
     */
    BusinessGroupImpl businessgroup = null;
    Manager securityManager = ManagerFactory.getManager();
    // groups
    SecurityGroup ownerGroup = securityManager.createAndPersistSecurityGroup();
    SecurityGroup partipiciantGroup = securityManager.createAndPersistSecurityGroup();

    businessgroup = new BusinessGroupImpl(BusinessGroup.TYPE_BUDDYGROUP, name, description, ownerGroup, partipiciantGroup,null/* no waitingGroup*/, null);
    businessgroup.setMinParticipants(minParticipants);
    businessgroup.setMaxParticipants(maxParticipants);

    DBFactory.getInstance().saveObject(businessgroup);
    if(Tracing.isDebugEnabled(BusinessGroupFactory.class)){
      Tracing.logDebug("created Buddy Group named " + name + " for Identity " + identity, BusinessGroupFactory.class);
    }
    /*
     * policies: - ownerGroup can do everything on this businessgroup -> is an
     * admin, can invite people to owner.- & partipiciantgroup -
     * partipiciantGroup can read this businessgroup
     */
    OLATResource businessgroupOlatResource =  OLATResourceManager.getInstance().createOLATResourceInstance(businessgroup);
    OLATResourceManager.getInstance().saveOLATResource(businessgroupOlatResource);

    //    securityManager.createAndPersistPolicy(ownerGroup, Constants.PERMISSION_ACCESS, businessgroup);
    securityManager.createAndPersistPolicyWithResource(ownerGroup, Constants.PERMISSION_ACCESS, businessgroupOlatResource);
    securityManager.createAndPersistPolicyWithResource(partipiciantGroup, Constants.PERMISSION_READ, businessgroupOlatResource);
    // membership: add identity
    securityManager.addIdentityToSecurityGroup(identity, ownerGroup);

    // per default all collaboration-tools are disabled

    // group members visibility
    BusinessGroupPropertyManager bgpm = new BusinessGroupPropertyManager(businessgroup);
View Full Code Here

Examples of org.olat.basesecurity.Manager

     * security groups...................................................... [3]
     * create 2 policies, ownerGroup -> PERMISSION_ACCESS ....partipiciantGroup ->
     * PERMISSION_READ
     */
    BusinessGroupImpl businessgroup = null;
    Manager securityManager = ManagerFactory.getManager();

    // check if group does already exist in this learning context
    boolean groupExists = testIfGroupAlreadyExists(name, BusinessGroup.TYPE_LEARNINGROUP, groupContext);
    if (groupExists) {
      // there is already a group with this name, return without
      // creating a new group
      Tracing.logWarn("A group with this name already exists! You will get null instead of a businessGroup returned!", BusinessGroupFactory.class);
      return null;
    }
    Codepoint.codepoint(BusinessGroupFactory.class, "createAndPersistLearningGroup");
    // groups
    SecurityGroup ownerGroup = securityManager.createAndPersistSecurityGroup();
    SecurityGroup partipiciantGroup = securityManager.createAndPersistSecurityGroup();
    SecurityGroup waitingGroup = securityManager.createAndPersistSecurityGroup();
    //
    businessgroup = new BusinessGroupImpl(BusinessGroup.TYPE_LEARNINGROUP, name, description, ownerGroup, partipiciantGroup, waitingGroup, groupContext);
    businessgroup.setMinParticipants(minParticipants);
    businessgroup.setMaxParticipants(maxParticipants);
    businessgroup.setWaitingListEnabled(waitingListEnabled);
    businessgroup.setAutoCloseRanksEnabled(autoCloseRanksEnabled);
   
    DBFactory.getInstance().saveObject(businessgroup);
    if(Tracing.isDebugEnabled(BusinessGroupFactory.class)){
      Tracing.logDebug("created Learning Group named " + name, BusinessGroupFactory.class);
    }
    /*
     * policies: - ownerGroup can do everything on this businessgroup -> is an
     * admin, can invite people to owner.- & partipiciantgroup -
     * partipiciantGroup can read this businessgroup
     */
    OLATResource businessgroupOlatResource = OLATResourceManager.getInstance().createOLATResourceInstance(businessgroup);
    OLATResourceManager.getInstance().saveOLATResource(businessgroupOlatResource);
    OLATResource groupContextOlatResource = OLATResourceManager.getInstance().findResourceable(groupContext);
    if (groupContextOlatResource == null) {
      OLATResourceManager.getInstance().createOLATResourceInstance(groupContext);
      OLATResourceManager.getInstance().saveOLATResource(groupContextOlatResource);
    }
    securityManager.createAndPersistPolicyWithResource(ownerGroup, Constants.PERMISSION_ACCESS, businessgroupOlatResource);
    securityManager.createAndPersistPolicyWithResource(ownerGroup, Constants.PERMISSION_COACH, groupContextOlatResource);
    securityManager.createAndPersistPolicyWithResource(partipiciantGroup, Constants.PERMISSION_READ, businessgroupOlatResource);
    securityManager.createAndPersistPolicyWithResource(partipiciantGroup, Constants.PERMISSION_PARTI, groupContextOlatResource);
    // membership: add identity if available
    if (identity != null) {
      securityManager.addIdentityToSecurityGroup(identity, ownerGroup);
    }

    // per default all collaboration-tools are disabled

    // group members visibility
View Full Code Here

Examples of org.olat.basesecurity.Manager

     * learningGroup with name, description, introMsg and the security
     * group...................................................... [3] create 2
     * policies, partipiciantGroup -> PERMISSION_READ
     */
    BusinessGroupImpl businessgroup = null;
    Manager securityManager = ManagerFactory.getManager();

    // check if group does already exist in this learning context
    boolean groupExists = testIfGroupAlreadyExists(name, BusinessGroup.TYPE_RIGHTGROUP, groupContext);
    if (groupExists) {
      // there is already a group with this name, return without
      // creating a new group
      return null;
    }

    // group
    SecurityGroup partipiciantGroup = securityManager.createAndPersistSecurityGroup();
    //
    businessgroup = new BusinessGroupImpl(BusinessGroup.TYPE_RIGHTGROUP, name, description, null, partipiciantGroup,null/* no waitingGroup */, groupContext);
    businessgroup.setMinParticipants(minParticipants);
    businessgroup.setMaxParticipants(maxParticipants);
    //
    DBFactory.getInstance().saveObject(businessgroup);
    if(Tracing.isDebugEnabled(BusinessGroupFactory.class)){
      Tracing.logDebug("Created Right Group named " + name, BusinessGroupFactory.class);
    }
    /*
     * policies: - partipiciantGroup can read this businessgroup
     */
    OLATResource businessgroupOlatResource = OLATResourceManager.getInstance().createOLATResourceInstance(businessgroup);
    OLATResourceManager.getInstance().saveOLATResource(businessgroupOlatResource);
    securityManager.createAndPersistPolicyWithResource(partipiciantGroup, Constants.PERMISSION_READ, businessgroupOlatResource);
    // membership: add identity if available
    if (identity != null) {
      securityManager.addIdentityToSecurityGroup(identity, partipiciantGroup);
    }

    // per default all collaboration-tools are disabled

    // group members visibility
View Full Code Here

Examples of org.olat.basesecurity.Manager

   * @param changeableUser
   */
  public UserChangePasswordController(UserRequest ureq, WindowControl wControl, Identity changeableUser) {
    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 UserChangePasswordController");

View Full Code Here

Examples of org.olat.basesecurity.Manager

  /** rights tests */
  public void testHasRightIsInMethods() {
      BGContextManager cm = BGContextManagerImpl.getInstance();
      BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
      Manager secm = ManagerFactory.getManager();
      BGRightManager rm = BGRightManagerImpl.getInstance();
      BGAreaManager am = BGAreaManagerImpl.getInstance();
     
      // 1) context one: learning groups
      BGContext c1 = cm.createAndAddBGContextToResource("c1name", course1, BusinessGroup.TYPE_LEARNINGROUP, id1, true);
      // create groups without waitinglist
      BusinessGroup g1 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, null, "g1", null, new Integer(0), new Integer(10), false, false, c1);
      BusinessGroup g2 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, null, "g2", null, new Integer(0), new Integer(10), false, false, c1);
      // members
      secm.addIdentityToSecurityGroup(id1, g2.getOwnerGroup());
      secm.addIdentityToSecurityGroup(id1, g1.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id2, g1.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id2, g2.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id3, g1.getOwnerGroup());
      // areas
      BGArea a1 = am.createAndPersistBGAreaIfNotExists("a1", "desca1",c1);
      BGArea a2 = am.createAndPersistBGAreaIfNotExists("a2", null, c1);
      BGArea a3 = am.createAndPersistBGAreaIfNotExists("a3", null, c1);
      am.addBGToBGArea(g1, a1);   
      am.addBGToBGArea(g2, a1);
      am.addBGToBGArea(g1, a2)
      am.addBGToBGArea(g2, a3);
     
      // 2) context two: right groups
      BGContext c2 = cm.createAndAddBGContextToResource("c2name", course1, BusinessGroup.TYPE_RIGHTGROUP, id2, true);
      // groups
      BusinessGroup g3 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_RIGHTGROUP, null, "g3", null, null, null, null/* enableWaitinglist */, null/* enableAutoCloseRanks */, c2);
      BusinessGroup g4 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_RIGHTGROUP, null, "g4", null, null, null, null/* enableWaitinglist */, null/* enableAutoCloseRanks */, c2);
      // members
      secm.addIdentityToSecurityGroup(id1, g3.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id1, g4.getPartipiciantGroup());
      secm.addIdentityToSecurityGroup(id3, g4.getPartipiciantGroup());
      // rights
      rm.addBGRight(CourseRights.RIGHT_ARCHIVING, g3);
      rm.addBGRight(CourseRights.RIGHT_COURSEEDITOR, g3);
      rm.addBGRight(CourseRights.RIGHT_ARCHIVING, g4);
      rm.addBGRight(CourseRights.RIGHT_GROUPMANAGEMENT, g4);
View Full Code Here

Examples of org.olat.basesecurity.Manager

    this.showEmailButton = showEmailButton;

    userListVC.contextPut("showBackButton", Boolean.FALSE);
    userListVC.contextPut("showTitle", Boolean.TRUE);

    Manager secMgr = ManagerFactory.getManager();
    identitiesList = secMgr.getIdentitiesByPowerSearch(null, null, true, searchGroups, searchPermissionOnResources, searchAuthProviders,
        searchCreatedAfter, searchCreatedBefore, status);

    initUserListCtr(ureq, identitiesList, status);
    userListVC.put("userlist", tableCtr.getInitialComponent());
    userListVC.contextPut("emptyList", (identitiesList.size() == 0 ? Boolean.TRUE : Boolean.FALSE));
View Full Code Here

Examples of org.olat.basesecurity.Manager

   *
   * @param ureq
   */
  private void doBuddyGroupDelete(UserRequest ureq) {
    // 1) send notification mails to users
    Manager securityManager = ManagerFactory.getManager();
    ContactList owners = new ContactList(translate("userlist.owners.title"));
    List ow = securityManager.getIdentitiesOfSecurityGroup(currBusinessGroup.getOwnerGroup());
    owners.addAllIdentites(ow);
    ContactList participants = new ContactList(translate("userlist.participants.title"));
    participants.addAllIdentites(securityManager.getIdentitiesOfSecurityGroup(currBusinessGroup.getPartipiciantGroup()));
    // check if user is in owner group (could fake link in table)
    if (!PersistenceHelper.listContainsObjectByKey(ow, ureq.getIdentity())) {
      Tracing.logWarn("User tried to delete a group but he was not owner of the group", null, BGMainController.class);
      return;
    }
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.