/* This is used to add user auto-completion to EmailAlarmCallback when the current user has permissions to list users
964461
private ConfigurationRequest getConfigurationRequest(AlarmCallback callback) {
        if (callback instanceof EmailAlarmCallback && isPermitted(USERS_LIST)) {
            return ((EmailAlarmCallback) callback).getEnrichedRequestedConfiguration();
        }

        return callback.getRequestedConfiguration();
    }
247831
@Programmatic
    public ApplicationUser newLocalUser(
            final String username,
            final Password password,
            final Password passwordRepeat,
            final ApplicationRole initialRole,
            final Boolean enabled,
            final String emailAddress) {
        ApplicationUser user = findByUsername(username);
        if (user == null) {
            user = getApplicationUserFactory().newApplicationUser();
            user.setUsername(username);
            user.setStatus(ApplicationUserStatus.parse(enabled));
            user.setAccountType(AccountType.LOCAL);
        }
        if (initialRole != null) {
            user.addRole(initialRole);
        }
        if (password != null) {
            user.updatePassword(password.getPassword());
        }
        if (emailAddress != null) {
            user.updateEmailAddress(emailAddress);
        }
        container.persistIfNotAlready(user);
        return user;
    }
878982
@Override
	public List<TaskSummary> getTasksAssignedAsBusinessAdministrator(String userId, String language) {
		return delegate.getTasksAssignedAsBusinessAdministrator(userId, language);
	}
1125534
function(email) {
      var user = this.getAuth();
      if (user) {
        return this._q.when(user.updateEmail(email));
      } else {
        return this._q.reject("Cannot update email since there is no logged in user.");
      }
    }
344602
function (user, req, cb) {
  CoreController.getPluginViewDefaultTemplate({
    viewname: 'email/user/forgot_password_link',
    themefileext: appSettings.templatefileextension,
  },
		function (err, templatepath) {
  if (err) {
    cb(err);
  }			else {
				// console.log('emailForgotPasswordLink templatepath', templatepath);
    if (templatepath === 'email/user/forgot_password_link') {
      templatepath = path.resolve(process.cwd(), 'node_modules/periodicjs.ext.login/views', templatepath + '.' + appSettings.templatefileextension);
    }
				// console.log('user for forgot password', user);
    var coreMailerOptions = {
      appenvironment: appenvironment,
      to: user.email,
      from: appSettings.fromemail || appSettings.adminnotificationemail,
      replyTo: appSettings.fromemail || appSettings.adminnotificationemail,
      subject: loginExtSettings.settings.forgotPasswordEmailSubject || appSettings.name + ' - Reset your password',
      emailtemplatefilepath: templatepath,
      emailtemplatedata: {
        user: user,
        appname: appSettings.name,
        hostname: req.headers.host,
        filename: templatepath,
        adminPostRoute: req.adminPostRoute,
      },
    };
    if (loginExtSettings.settings.adminbccemail || appSettings.adminbccemail) {
      coreMailerOptions.bcc = loginExtSettings.settings.adminbccemail || appSettings.adminbccemail;
    }
    CoreMailer.sendEmail(coreMailerOptions, cb);
  }
}
	);
	// cb(null, options);
}
116490
function onAuthorizedAccess() {
          if (angular.isFunction(permission.onAuthorized)) {
            permission.onAuthorized()($element);
          } else {
            var onAuthorizedMethodName = $permission.defaultOnAuthorizedMethod;
            PermPermissionStrategies[onAuthorizedMethodName]($element);
          }
        }
1224478
public void identity_user_POST(String description, String email, String group, String login, String password) throws IOException {
		String qPath = "/me/identity/user";
		StringBuilder sb = path(qPath);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "description", description);
		addBody(o, "email", email);
		addBody(o, "group", group);
		addBody(o, "login", login);
		addBody(o, "password", password);
		exec(qPath, "POST", sb.toString(), o);
	}
65761
function parseUserlistEntry(nickWithFlags) {
	const userlistEntry = new UserlistEntry();
	for (let i of indices(nickWithFlags.length)) {
		switch (nickWithFlags.charAt(i)) {
			case '~':
				userlistEntry.owner = true;
				break;
			case '&':
				userlistEntry.admin = true;
				break;
			case '@':
				userlistEntry.op = true;
				break;
			case '%':
				userlistEntry.halfop = true;
				break;
			case '+':
				userlistEntry.voice = true;
				break;
			default:
				userlistEntry.nick = nickWithFlags.substring(i);
				return userlistEntry;
		}
	}

	// if here, we got an empty name
	return null;
}
664016
@Override
    public java.util.concurrent.Future<AddPermissionResult> addPermissionAsync(String topicArn, String label, java.util.List<String> aWSAccountIds,
            java.util.List<String> actionNames, com.amazonaws.handlers.AsyncHandler<AddPermissionRequest, AddPermissionResult> asyncHandler) {

        return addPermissionAsync(
                new AddPermissionRequest().withTopicArn(topicArn).withLabel(label).withAWSAccountIds(aWSAccountIds).withActionNames(actionNames), asyncHandler);
    }
575011
public void addAutoLoginHandler()
    {
        this.getMainRecord().addListener(new FileListener(null)
        {
            public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
            {   // Return an error to stop the change
                int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
                if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
                    if (iErrorCode == DBConstants.NORMAL_RETURN)
                {
                    Record recUserInfo = this.getOwner();
                    Task task = recUserInfo.getTask();
                    String strUserName = recUserInfo.getField(UserInfo.ID).toString();
                    if ((strUserName == null) || (strUserName.length() == 0))
                        strUserName = recUserInfo.getLastModified(DBConstants.BOOKMARK_HANDLE).toString();
                    String strPassword = recUserInfo.getField(UserInfo.PASSWORD).toString();
                    iErrorCode = task.getApplication().login(task, strUserName, strPassword, task.getProperty(DBParams.DOMAIN));   // Always okay
                }
                return iErrorCode;
            }
        });
    }
37383
function acl_autocomplete()
    {
        $this->load_config();

        $search = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC, true);
        $reqid  = rcube_utils::get_input_value('_reqid', rcube_utils::INPUT_GPC);
        $users  = array();
        $keys   = array();

        if ($this->init_ldap()) {
            $max  = (int) $this->rc->config->get('autocomplete_max', 15);
            $mode = (int) $this->rc->config->get('addressbook_search_mode');

            $this->ldap->set_pagesize($max);
            $result = $this->ldap->search('*', $search, $mode);

            foreach ($result->records as $record) {
                $user = $record['uid'];

                if (is_array($user)) {
                    $user = array_filter($user);
                    $user = $user[0];
                }

                if ($user) {
                    $display = rcube_addressbook::compose_search_name($record);
                    $user    = array('name' => $user, 'display' => $display);
                    $users[] = $user;
                    $keys[]  = $display ?: $user['name'];
                }
            }

            if ($this->rc->config->get('acl_groups')) {
                $prefix      = $this->rc->config->get('acl_group_prefix');
                $group_field = $this->rc->config->get('acl_group_field', 'name');
                $result      = $this->ldap->list_groups($search, $mode);

                foreach ($result as $record) {
                    $group    = $record['name'];
                    $group_id = is_array($record[$group_field]) ? $record[$group_field][0] : $record[$group_field];

                    if ($group) {
                        $users[] = array('name' => ($prefix ?: '') . $group_id, 'display' => $group, 'type' => 'group');
                        $keys[]  = $group;
                    }
                }
            }
        }

        if (count($users)) {
            // sort users index
            asort($keys, SORT_LOCALE_STRING);
            // re-sort users according to index
            foreach ($keys as $idx => $val) {
                $keys[$idx] = $users[$idx];
            }
            $users = array_values($keys);
        }

        $this->rc->output->command('ksearch_query_results', $users, $search, $reqid);
        $this->rc->output->send();
    }
1097060
public void loginWithEmail(String email, String password, final SimpleLoginAuthenticatedHandler completionHandler) {
    if (!Validation.isValidEmail(email)) {
      handleInvalidEmail(completionHandler);
    }
    else if (!Validation.isValidPassword(password)) {
      handleInvalidPassword(completionHandler);
    }
    else {
      HashMap<String, String> data = new HashMap<String, String>();
      data.put("email", email);
      data.put("password", password);

      makeRequest(Constants.FIREBASE_AUTH_PASSWORD_PATH, data, new RequestHandler() {
        public void handle(FirebaseSimpleLoginError error, JSONObject data) {
          if (error != null) {
            completionHandler.authenticated(error, null);
          }
          else {
            try {
              String token = data.has("token") ? data.getString("token") : null;
              if (token == null) {
                JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null;
                FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(errorDetails);
                completionHandler.authenticated(theError, null);
              }
              else {
                JSONObject userData = data.has("user") ? data.getJSONObject("user") : null;
                if (userData == null) {
                  FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
                  completionHandler.authenticated(theError, null);
                }
                else {
                  attemptAuthWithToken(token, Provider.PASSWORD, userData, completionHandler);
                }
              }
            }
            catch (JSONException e) {
              e.printStackTrace();
              FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
              completionHandler.authenticated(theError, null);
            }
          }
        }

      });
    }
  }
675124
@Override
    public java.util.concurrent.Future<AddPermissionResult> addPermissionAsync(String queueUrl, String label, java.util.List<String> aWSAccountIds,
            java.util.List<String> actions, com.amazonaws.handlers.AsyncHandler<AddPermissionRequest, AddPermissionResult> asyncHandler) {

        return addPermissionAsync(new AddPermissionRequest().withQueueUrl(queueUrl).withLabel(label).withAWSAccountIds(aWSAccountIds).withActions(actions),
                asyncHandler);
    }
552012
@Override
    public SendInvitation invitees(ApiBaseUser... users) {
        this.invitees.addAll(Arrays.asList(users));
        return this;
    }
1048134
public void setUserEmailList(java.util.Collection<String> userEmailList) {
        if (userEmailList == null) {
            this.userEmailList = null;
            return;
        }

        this.userEmailList = new java.util.ArrayList<String>(userEmailList);
    }
1146987
@Programmatic
    public List<ApplicationPermission> findByUserCached(final ApplicationUser user) {
        return queryResultsCache.execute(new Callable<List<ApplicationPermission>>() {
            @Override public List<ApplicationPermission> call() throws Exception {
                return findByUser(user);
            }
        }, ApplicationPermissionRepository.class, "findByUserCached", user);
    }
15675
function onApplyActionCode() {
  var code = $('#email-verification-code').val();
  auth.applyActionCode(code).then(function() {
    alertSuccess('Email successfully verified!');
    refreshUserData();
  }, onAuthError);
}