Package org.olat.core.id

Examples of org.olat.core.id.Identity


    }
  }

  private Identity createIdentity(String login) {
    User testUser = new TestUser(login + "olattest@" + maildomain, login + "first", login + "last");
    Identity id = new TestIdentity(login, testUser);
    return id;
  }
View Full Code Here


      // nothing to do
      }
    };

    // some recipients data
    Identity illegal1 = createIdentity("illegal1");
    illegal1.getUser().setProperty(UserConstants.EMAIL, "doesnotexisteserlkmlkm@sdf.com");
    Identity illegal2 = createIdentity("illegal2");
    illegal2.getUser().setProperty(UserConstants.EMAIL, "sd@this.domain.does.not.exist.at.all");
    Identity illegal3 = createIdentity("illegal3");
    illegal3.getUser().setProperty(UserConstants.EMAIL, "@ sdf");

    List<Identity> recipients = new ArrayList<Identity>();
    List<Identity> recipientsCC = new ArrayList<Identity>();
    List<Identity> recipientsBCC = new ArrayList<Identity>();
View Full Code Here

     */
    String attName = (String) inStack[0];
    String attValue = (String) inStack[1];
   
    IdentityEnvironment ienv = getUserCourseEnv().getIdentityEnvironment();
    Identity ident = ienv.getIdentity();
    Map attributes = ienv.getAttributes();
    if (attributes == null) return ConditionInterpreter.INT_FALSE;
    String value = (String)attributes.get(attName);
   
    boolean match = false;
    if (Tracing.isDebugEnabled(EvalAttributeFunction.class)) {
      Tracing.logDebug("value    : " + value, EvalAttributeFunction.class);
      Tracing.logDebug("attrValue: " + attValue, EvalAttributeFunction.class);
      Tracing.logDebug("fT       :  " + functionType, EvalAttributeFunction.class);
    }
    if (value != null) {
      if (functionType <= FUNCTION_TYPE_IS_NOT_IN_ATTRIBUTE) {
        match = findExpressionInMultiValue(attValue, value, functionType);
      } else if (functionType == FUNCTION_TYPE_HAS_NOT_ATTRIBUTE) {
        match = !findExpressionInMultiValue(attValue, value, FUNCTION_TYPE_HAS_ATTRIBUTE);
      }
    }   

    if (Tracing.isDebugEnabled(EvalAttributeFunction.class)) {
      Tracing.logDebug("identity '" + ident.getName() + "' tested on attribute '" + attName + "' to have value '" +
          attValue + "' user's value was '" + value + "', match=" + match, EvalAttributeFunction.class);
    }
    return match ? ConditionInterpreter.INT_TRUE : ConditionInterpreter.INT_FALSE;
  }
View Full Code Here

    // TODO fg: check with editor tree model DONE: the above checks ensure only
    // valid node references
    // if (node == null) return new Double(Double.NEGATIVE_INFINITY);

    CoursePropertyManager pm = getUserCourseEnv().getCourseEnvironment().getCoursePropertyManager();
    Identity identity = getUserCourseEnv().getIdentityEnvironment().getIdentity();

    Property firstTime = pm.findCourseNodeProperty(node, identity, null, ENCourseNode.PROPERTY_INITIAL_ENROLLMENT_DATE);

    if (firstTime != null) {
      String firstTimeMillis = firstTime.getStringValue();
View Full Code Here

      boolean setReplayURL = form.isOn();
      String password = form.getPassword();
      for (int i = 0; i < usernames.length; i++) {
        int pos = i %  20;
        String identityName = usernames[i];
        Identity identity = ManagerFactory.getManager().findIdentityByName(identityName);
        bulkprefs[pos] = PreferencesFactory.getInstance().getPreferencesFor(identity, false);
        if (setReplayURL) {
          // selected -> true disable also ajax mode
          bulkprefs[pos].putAndSave(WindowManager.class, "replayURLs", Boolean.TRUE);
          bulkprefs[pos].putAndSave(WindowManager.class, "ajax-beta-on", Boolean.FALSE);
View Full Code Here

    if (cev != null) {
      // return a valid value to continue with condition evaluation test
      return defaultValue();
    }
   
    Identity ident = getUserCourseEnv().getIdentityEnvironment().getIdentity();
    String identName = ident.getName();
   
    return identName.equals(userName) ? ConditionInterpreter.INT_TRUE: ConditionInterpreter.INT_FALSE;
  }
View Full Code Here

    if (cev != null) {
      // return a valid value to continue with condition evaluation test
      return defaultValue();
    }

    Identity ident = getUserCourseEnv().getIdentityEnvironment().getIdentity();
    CourseGroupManager cgm = getUserCourseEnv().getCourseEnvironment().getCourseGroupManager();
    boolean isCourseCoach = cgm.isIdentityCourseCoach(ident);
    if (Tracing.isDebugEnabled(IsCourseCoachFunction.class)) {
      Tracing.logDebug("identity "+ident.getName()+", coursecoach:"+isCourseCoach+", in course "+getUserCourseEnv().getCourseEnvironment().getCourseResourceableId(), IsCourseCoachFunction.class);
    }
   
    return isCourseCoach ? ConditionInterpreter.INT_TRUE: ConditionInterpreter.INT_FALSE;
  }
View Full Code Here

    int startUselessUri = pathInfo.indexOf("/", startIdToken + 1);
    String idToken = pathInfo.substring(startIdToken + 1, startUselessUri);

    // ---- check integrity and user authentication ----
    if (idName == null || idName.equals("")) { return null; }
    Identity identity = ManagerFactory.getManager().findIdentityByName(idName);
    if (identity == null) {
      // error - abort
      return null;
    }
    // check if this is a valid authentication
View Full Code Here

        wic.setCurStep(4);
        myContent.contextPut("pwdhelp", "");
        myContent.contextPut("text", translate("step4.pw.text"));
        pwchangeHomelink = LinkFactory.createLink("pwchange.homelink", myContent, this);
        pwf.setVisible(false);
        Identity identToChange = UserManager.getInstance().findIdentityByEmail(tempKey.getEmailAddress());
        if(identToChange == null || !pwf.saveFormData(identToChange)) {
          getWindowControl().setError(translate("pwchange.failed"));
        }
        rm.deleteTemporaryKeyWithId(tempKey.getRegistrationKey());       
      } else if (event == Form.EVNT_FORM_CANCELLED) {
View Full Code Here

        if(isLogDebugEnabled()) {
          logDebug("this servername is " + servername + " and serverpath is " + serverpath, null);
        }

        // Look for user in "Person" and "user" tables
        Identity identity = null;
        // See if the entered value is a username
        identity = ManagerFactory.getManager().findIdentityByName(emailOrUsername);
        if (identity == null) {
          // Try fallback with email, maybe user used his email address instead
          // only do this, if its really an email, may lead to multiple results else.
          if (MailHelper.isValidEmailAddress(emailOrUsername)) {
            identity = UserManager.getInstance().findIdentityByEmail(emailOrUsername);
          }
        }
        if (identity != null) {
          // check if user has an OLAT provider token, otherwhise a pwd change makes no sense
          Authentication auth = ManagerFactory.getManager().findAuthentication(identity, OLATAuthenticationController.PROVIDER_OLAT);
          if (auth == null) {
            getWindowControl().setWarning(translate("password.cantchange"));
            return;
          }
          Preferences prefs = identity.getUser().getPreferences();
          Locale locale = I18nManager.getInstance().getLocaleOrDefault(prefs.getLanguage());
          ureq.getUserSession().setLocale(locale);
          myContent.contextPut("locale", locale);
          Translator userTrans = Util.createPackageTranslator(PwChangeController.class, locale) ;
          String emailAdress = identity.getUser().getProperty(UserConstants.EMAIL, locale);
          TemporaryKey tk = rm.loadTemporaryKeyByEmail(emailAdress);
          if (tk == null) tk = rm.createTemporaryKeyByEmail(emailAdress, ip, rm.PW_CHANGE);
          myContent.contextPut("pwKey", tk.getRegistrationKey());
          body = userTrans.translate("pwchange.intro", new String[] { identity.getName() })
              + userTrans.translate("pwchange.body", new String[] { serverpath, tk.getRegistrationKey(),
                  I18nManager.getInstance().getLocaleKey(ureq.getLocale()) }) + SEPARATOR
              + userTrans.translate("reg.wherefrom", new String[] { serverpath, today, ip });
          subject = userTrans.translate("pwchange.subject");
          MailTemplate mailTempl = new MailTemplate(subject, body, null) {
View Full Code Here

TOP

Related Classes of org.olat.core.id.Identity

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.