Searches active human tasks by role and/or user.

<pre>
Request:  GET /humanTask/search?role=auditor&user=hans
Response: OK, [{refNum:3, woinRefNum:1, tokenId:2, status:EXECUTED, role:"auditor", user:"hans", arguments:{task:"audit customer 500"}}]
</pre>
165558
@RequestMapping(method = RequestMethod.GET, value = "/humanTask/search",
            produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE})
    public ResponseEntity<List<HumanTaskModel>> findActiveHumanTasks( @RequestParam(required = false) String role,
                                                                      @RequestParam(required = false) String user ){
        if( StringUtils.isBlank( role ) && StringUtils.isBlank( user ) ){
            return new ResponseEntity<>( HttpStatus.BAD_REQUEST );
        }
        List<WorkItemState> woits = facade.findActiveHumanTasksByRoleAndUser( role, user );
        return new ResponseEntity<>( createHumanTasksModel( woits ), HttpStatus.OK );
    }
927290
public function listTask()
	{
		$query = $this->resolveModel();

		$properties = $query->getStructure()->getTableColumns($query->getTableName());
		$properties = $this->normalizeProperties($properties);

		$searches = array();

		// Build a list of incoming filters from
		// the propertes of the model
		foreach ($properties as $property => $type)
		{
			if ($property == $query->getPrimaryKey())
			{
				continue;
			}

			if ($type == 'text')
			{
				$searches[] = $property;
				continue;
			}

			if ($type == 'integer')
			{
				$dflt = null;

				// 'state' is a very commonly used field and we want
				// it to default to published entries
				if ($property == 'state')
				{
					$dflt = $query::STATE_PUBLISHED;
					if (User::authorise('core.manage', $this->_option))
					{
						$dflt = null;
					}
				}

				$filters[$property] = Request::getInt($property, $dflt);

				// 'access' is another commonly used field where we
				// want to control what values are actually allowed
				if ($property == 'access')
				{
					if (is_null($filters[$property]))
					{
						$filters[$property] = User::getAuthorisedViewLevels();
					}
				}
			}
			else
			{
				$filters[$property] = Request::getVar($property);
			}
		}

		$filters['sort'] = Request::getString('sort', $query->orderBy);
		$filters['sort_Dir'] = Request::getWord('sort_Dir', $query->orderDir);

		if (!isset($properties[$filters['sort']]))
		{
			$filters['sort'] = $query->orderBy;
		}

		if (!in_array($filters['sort_Dir'], array('asc', 'desc')))
		{
			$filters['sort_Dir'] = $query->orderDir;
		}

		foreach ($filters as $field => $value)
		{
			if ($field == 'sort' || $field == 'sort_Dir')
			{
				continue;
			}

			if (is_null($value))
			{
				continue;
			}

			if (is_array($value))
			{
				$query->whereIn($field, $value);
			}
			else
			{
				if ($properties[$field] == 'string' && !$value)
				{
					continue;
				}

				if ($properties[$field] == 'date' && !$value)
				{
					continue;
				}

				$query->whereEquals($field, $value);
			}
		}

		// Are searching for anything?
		if ($search = (string)Request::getString('search'))
		{
			foreach ($searches as $i => $property)
			{
				if ($i == 0)
				{
					$query->whereLike($property, $search, 1);
				}
				else
				{
					$query->orWhereLike($property, $search, 1);
				}
			}
			$query->resetDepth();
		}

		// Get a total record count
		$total = with(clone $query)->total();

		// Build the response
		$response = new stdClass;
		$response->records = array();
		$response->total = $total;

		if ($response->total)
		{
			$base = rtrim(Request::base(), '/');

			$rows = $query
				->order($filters['sort'], $filters['sort_Dir'])
				->paginated('limitstart', 'limit')
				->rows();

			foreach ($rows as $row)
			{
				$obj = $row->toObject();
				foreach ($properties as $property => $type)
				{
					if ($type == 'date')
					{
						if ($obj->$property && $obj->$property != '0000-00-00 00:00:00')
						{
							$obj->$property = with(new Date($obj->$property))->format('Y-m-d\TH:i:s\Z');
						}
					}
					if ($type == 'text')
					{
						unset($obj->$property);
					}
				}
				if (method_exists($row, 'link'))
				{
					$obj->url = str_replace('/api', '', $base . '/' . ltrim(Route::url($row->link()), '/'));
				}

				$response->records[] = $obj;
			}
		}

		$this->send($response);
	}
1170130
def search_task_views(self, user, search_string):
        
        magic = self._magic_json(
            action=TouchWorksMagicConstants.ACTION_SEARCH_TASK_VIEWS,
            parameter1=user,
            parameter2=search_string)

        response = self._http_request(TouchWorksEndPoints.MAGIC_JSON, data=magic)
        result = self._get_results_or_raise_if_magic_invalid(
            magic,
            response,
            TouchWorksMagicConstants.RESULT_SEARCH_TASK_VIEWS)
        return result
590172
def user_view_task(self, ):
        
        if not self.cur_user:
            return
        i = self.user_task_treev.currentIndex()
        item = i.internalPointer()
        if item:
            task = item.internal_data()
            if isinstance(task, djadapter.models.Task):
                self.view_task(task)
1160827
def get_user_submissions(self, task):
        
        if not self._user_manager.session_logged_in():
            raise Exception("A user must be logged in to get his submissions")

        cursor = self._database.submissions.find({"username": self._user_manager.session_username(),
                                                  "taskid": task.get_id(), "courseid": task.get_course_id()})
        cursor.sort([("submitted_on", -1)])
        return list(cursor)
200206
def get_query(self, q, request):
        
        return Person.objects.filter(
            Q(username__icontains=q)
            | Q(short_name__icontains=q)
            | Q(full_name__icontains=q)
        )
272951
public List<TaskSummary> doCriteriaQuery(String userId, UserGroupCallback userGroupCallback, QueryWhere queryWhere) {

        // 1. create builder and query instances
        CriteriaBuilder builder = getCriteriaBuilder();
        CriteriaQuery<Tuple> criteriaQuery = builder.createTupleQuery();

        // 2. query base
        Root<TaskImpl> taskRoot = criteriaQuery.from(TaskImpl.class);
        criteriaQuery = criteriaQuery.multiselect(
                taskRoot.get(TaskImpl_.id),                                                         // 0
                taskRoot.get(TaskImpl_.name),                                                       // 1
                taskRoot.get(TaskImpl_.subject),                                                    // 2
                taskRoot.get(TaskImpl_.description),                                                // 3

                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.status),                         // 4
                taskRoot.get(TaskImpl_.priority),                                                   // 5
                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.skipable),                       // 6

                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.actualOwner).get(UserImpl_.id),  // 7
                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.createdBy).get(UserImpl_.id),    // 8

                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.createdOn),                      // 9
                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.activationTime),                 // 10
                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.expirationTime),                 // 11

                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.processId),                      // 12
                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.processSessionId),               // 13
                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.processInstanceId),              // 14
                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.deploymentId),                   // 15

                taskRoot.get(TaskImpl_.subTaskStrategy),                                            // 16
                taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.parentId)                        // 17
                );
        taskRoot.join(TaskImpl_.taskData); // added for convienence sake, since other logic expects to find this join

        addUserGroupsViaCallBackToQueryWhere(userGroupCallback, queryWhere.getCriteria());

        // 3. check to see if there's already a user(/security)-limitation in the search
        checkExistingCriteriaForUserBasedLimit(queryWhere, userId, userGroupCallback);
        for( QueryModificationService queryModificationService : queryModificationServiceLoader ) {
            queryModificationService.optimizeCriteria(queryWhere);
        }

        // 4. process query criteria
        fillCriteriaQuery(criteriaQuery, queryWhere, builder, TaskImpl.class);

        // 5. retrieve result (after also applying meta-criteria)
        useDistinctWhenLefOuterJoinsPresent(criteriaQuery);
        List<Tuple> result = createQueryAndCallApplyMetaCriteriaAndGetResult(queryWhere, criteriaQuery, builder);

        List<TaskSummary> taskSummaryList = new ArrayList<TaskSummary>(result.size());
        for( Tuple tupleRow : result ) {
            int i = 0;
            //@formatter:off
            TaskSummaryImpl taskSummaryImpl = new TaskSummaryImpl(
               // id
               tupleRow.get(i++, Long.class),
               // name, subject, description
               tupleRow.get(i++, String.class), tupleRow.get(i++, String.class), tupleRow.get(i++, String.class),
               // status, prio, skippable
               tupleRow.get(i++, Status.class), tupleRow.get(i++, Integer.class), tupleRow.get(i++, Boolean.class),
               // actual owner, created by
               tupleRow.get(i++, String.class), tupleRow.get(i++, String.class),
               // created on, activation time, expiration time
               tupleRow.get(i++, Date.class), tupleRow.get(i++, Date.class), tupleRow.get(i++, Date.class),
               // process id, process session id, process inst id, deployment id
               tupleRow.get(i++, String.class), tupleRow.get(i++, Long.class), tupleRow.get(i++, Long.class), tupleRow.get(i++, String.class),
               tupleRow.get(i++, SubTasksStrategy.class),
               tupleRow.get(i++, Long.class) );
            //@formatter:on
            taskSummaryList.add(taskSummaryImpl);

        }
        return taskSummaryList;
    }
1053162
def search(algo, params)
      algo.downcase!
      klass = "quorum/#{algo}_job_report".camelize.constantize
      if params[:"#{algo}_id"].present? && params[:query].present?
        klass.where(
          "quorum_#{algo}_job_reports.id IN (?) AND query = ? " <<
          "AND #{algo}_job_id = ?",
          params[:"#{algo}_id"].split(","),
          params[:query],
          params[:id]
        )
      elsif params[:"#{algo}_id"].present?
        klass.where(
          "quorum_#{algo}_job_reports.id IN (?) AND #{algo}_job_id = ? ",
          params[:"#{algo}_id"].split(","),
          params[:id]
        )
      elsif params[:query].present?
        klass.where(
          "query = ? AND #{algo}_job_id = ?",
          params[:query],
          params[:id]
        )
      else
        klass.where("#{algo}_job_id = ?", params[:id])
      end
    end
1042343
def get_user(user, driver):  # noqa: E501
    

    response = ApitaxResponse()

    driver: Driver = LoadedDrivers.getDriver(driver)
    user: User = driver.getApitaxUser(User(username=user))
    response.body.add({'user': {'username': user.username, 'role': user.role}})

    return Response(status=200, body=response.getResponseBody())
173298
function getAuthUsernameAvailable(req, res) {

    if (!req.query || !req.query.username) {
      res.status(400).send('Please provide a username');
    } else {
      var query = {
        username: req.query.username
      };

      var userCollection = authConfig.strategy === 'password' ? users :
        providerAccounts;

      userCollection.find(query).exec()
        .then(function (matchingUsers) {
          res.status(200).send({
            data: matchingUsers.length === 0
          });
        })
        .then(null, util.makeErrorResponder(res));
    }
  }
853287
function getRole(user) {
      user = user || getCurrentUser();
      return _.find(userRoles, {role: user.role});
    }
709688
def search_users(self):
        
        return bind_api(
            api=self,
            path='/users/search.json',
            payload_type='user', payload_list=True,
            require_auth=True,
            allowed_param=['q', 'count', 'page']
        )
913955
def users(accountable, query):
    
    users = accountable.users(query)
    headers = ['display_name', 'key']
    if users:
        rows = [[v for k, v in sorted(u.items()) if k in headers]
                for u in users]
        rows.insert(0, headers)
        print_table(SingleTable(rows))
    else:
        click.secho('No users found for query {}'.format(
            query
        ), fg='red')
788523
def get(method, hmc, uri, uri_parms, logon_required):
        """"""
        query_str = uri_parms[0]
        try:
            console = hmc.consoles.lookup_by_oid(None)
        except KeyError:
            raise InvalidResourceError(method, uri)
        result_user_patterns = []
        filter_args = parse_query_parms(method, uri, query_str)
        for user_pattern in console.user_patterns.list(filter_args):
            result_user_pattern = {}
            for prop in user_pattern.properties:
                if prop in ('element-uri', 'name', 'type'):
                    result_user_pattern[prop] = user_pattern.properties[prop]
            result_user_patterns.append(result_user_pattern)
        return {'user-patterns': result_user_patterns}
1146259
@Override
    public List<IPersonAttributes> searchForPeople(
            final IPerson searcher, final Map<String, Object> query) {

        // get the IAuthorizationPrincipal for the searching user
        final IAuthorizationPrincipal principal = getPrincipalForUser(searcher);

        // build a set of all possible user attributes the current user has
        // permission to view
        final Set<String> permittedAttributes = getPermittedAttributes(principal);

        // remove any query attributes that the user does not have permission
        // to view
        final Map<String, Object> inUseQuery = new HashMap<>();
        for (Map.Entry<String, Object> queryEntry : query.entrySet()) {
            final String attr = queryEntry.getKey();
            if (permittedAttributes.contains(attr)) {
                inUseQuery.put(attr, queryEntry.getValue());
            } else {
                this.logger.warn(
                        "User '"
                                + searcher.getName()
                                + "' attempted searching on attribute '"
                                + attr
                                + "' which is not allowed in the current configuration. The attribute will be ignored.");
            }
        }

        // ensure the query has at least one search attribute defined
        if (inUseQuery.keySet().size() == 0) {
            throw new IllegalArgumentException("Search query is empty");
        }

        // get the set of people matching the search query
        final Set<IPersonAttributes> people = this.personAttributeDao.getPeople(inUseQuery);
        if (people == null) {
            return Collections.emptyList();
        }

        // To improve efficiency and not do as many permission checks or person directory searches,
        // if we have too many results and all people in the returned set of personAttributes have
        // a displayName, pre-sort the set and limit it to maxResults. The typical use case is that
        // LDAP returns results that have the displayName populated.  Note that a disadvantage of
        // this
        // approach is that the smaller result set may have entries that permissions prevent the
        // current users from viewing the person and thus reduce the number of final results, but
        // that is rare (typical use case is users can't view administrative internal accounts or
        // the
        // system account, none of which tend to be in LDAP).  We could retain a few more than
        // maxResults
        // to offset that chance, but IMHO not worth the cost of extra external queries.

        List<IPersonAttributes> peopleList = new ArrayList<>(people);
        if (peopleList.size() > maxResults && allListItemsHaveDisplayName(peopleList)) {
            logger.debug(
                    "All items contained displayName; pre-sorting list of size {} and truncating to {}",
                    peopleList.size(),
                    maxResults);
            // sort the list by display name
            Collections.sort(peopleList, new DisplayNameComparator());
            peopleList = peopleList.subList(0, maxResults);
        }
        // Construct a new representation of the persons limited to attributes the searcher
        // has permissions to view.  Will change order of the list.
        List<IPersonAttributes> list =
                getVisiblePersons(principal, permittedAttributes, peopleList);

        // Sort the list by display name
        Collections.sort(list, new DisplayNameComparator());

        // limit the list to a maximum number of returned results
        if (list.size() > maxResults) {
            list = list.subList(0, maxResults);
        }

        return list;
    }
818953
public JSONObject getUserTasks(HashMap<String, String> options) {
        AipRequest request = new AipRequest();
        preOperation(request);
        if (options != null) {
            request.addBody(options);
        }
        request.setUri(KnowledgeGraphicConsts.TASK_QUERY);
        postOperation(request);
        return requestServer(request);
    }
855067
def get(self):
        """"""
        _, accounts = BaseAccount.search()

        if ROLE_ADMIN not in session['user'].roles:
            accounts = list(filter(lambda acct: acct.account_id in session['accounts'], accounts))

        if accounts:
            return self.make_response({
                'message': None,
                'accounts': [x.to_json(is_admin=ROLE_ADMIN in session['user'].roles or False) for x in accounts]
            })
        else:
            return self.make_response({
                'message': 'Unable to find any accounts',
                'accounts': None
            }, HTTP.NOT_FOUND)