Returns list of users of a role.
Resulted list can be customized by using filters, conditions and sort rules.

@param Pluf_HTTP_Request $request
@param array $match
763654
public static function find($request, $match)
    {
        $perm = Pluf_Shortcuts_GetObjectOr404('User_Role', $match['role_id']);
        $pag = new Pluf_Paginator(new User_Account());
        $sql = new Pluf_SQL('user_role_id=%s', array(
            $perm->id
        ));
        $pag->forced_where = $sql;
        $pag->list_filters = array(
            'is_active',
            'login',
            'first_name',
            'last_name',
            'email'
        );
        $pag->sort_order = array(
            'id',
            'ASC'
        );
        $search_fields = array(
            'login',
            'first_name',
            'last_name',
            'email'
        );
        $list_display = array(
            'login' => __('login'),
            'first_name' => __('first name'),
            'last_name' => __('last name'),
            'email' => __('email')
        );
        $sort_fields = array(
            'id',
            'login',
            'first_name',
            'last_name',
            'date_joined',
            'last_login'
        );
        $pag->model_view = 'join_role';
        $pag->configure($list_display, $search_fields, $sort_fields);
        $pag->setFromRequest($request);
        return $pag->render_object();
    }
1079529
private function parseRewriteRule( $match, $query ) {
        $matches = [ ];
        $request_match = $this->request;
        if ( ! empty( $this->request ) && strpos( $match, $this->request ) === 0 ) {
            $request_match = $this->request . '/' . $this->request;
        }
        if (
            preg_match( "#^{$match}#", $request_match, $matches )
            || preg_match( "#^{$match}#", urldecode( $request_match ), $matches )
        ) {
            $varmatch = NULL;
            if ( $this->resolver->isVerbose() && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
                $page = get_page_by_path( $matches[ $varmatch[1] ] );
                if ( ! $page ) {
                    return;
                }
            }
            $this->matched_rule = $match;
        }
        return $matches;
    }
938610
public function update($request, $match)
    {
        $currentUser = $request->user;
        $user = Pluf_Shortcuts_GetObjectOr404('User', $match['userId']);
        if($currentUser->getId() === $user->getId() || User_Precondition::ownerRequired($request)){
            $profileDoc = User_Views_CProfile::get_profile_document($user->id);
            User_Views_CProfile::putDocumentMap($profileDoc, $request->REQUEST);
            $docMap = User_Views_CProfile::getDocumentMap($profileDoc);
            $docMap['user'] = $user->id;
            return new Pluf_HTTP_Response_Json($docMap);
        }
        throw new Pluf_Exception_PermissionDenied("Permission is denied");
    }
156825
public static function delete($request, $match)
    {
        $group = Pluf_Shortcuts_GetObjectOr404('User_Group', $match['group_id']);
        $user = Pluf_Shortcuts_GetObjectOr404('User_Account', $match['user_id']);
        $group->delAssoc($user);
        return $user;
    }
898450
public function listPlatformRolesGrantableAction(Request $request)
    {
        return new JsonResponse(
            $this->finder->search('Claroline\CoreBundle\Entity\Role', array_merge(
                $request->query->all(),
                ['hiddenFilters' => ['type' => 1, 'grantable' => true]]
            ))
        );
    }
471940
public function listPoliciesForUser(Request $request)
    {
        return new Values\PolicyList(
            $this->roleService->loadPoliciesByUserId(
                $request->query->get('userId')
            ),
            $request->getPathInfo()
        );
    }
654103
public function update ($request, $match, $p)
    {
        // check collection
        if (isset($match['collectionId'])) {
            $collectionId = $match['collectionId'];
            $request->REQUEST['collection'] = $collectionId;
        } else {
            $collectionId = $request->REQUEST['collection'];
        }
        $collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection', 
                $collectionId);
        $document = Pluf_Shortcuts_GetObjectOr404('Collection_Document', 
                $match['modelId']);
        if ($document->collection !== $collection->id) {
            throw new Pluf_Exception_DoesNotExist(
                    'Document with id (' . $document->id .
                             ') does not exist in collection with id (' .
                             $collection->id . ')');
        }
        // update document
        $plufService = new Pluf_Views();
        return $plufService->updateObject($request, $match, $p);
    }
769426
public function loadGsonFile ($request, $match)
    {
        foreach ($request->FILES as $file) {
            if (is_readable($file['tmp_name'])) {
                Geo_Shortcuts_LoadJson($request->tenant, $request->user, $file['tmp_name']);
            }
        }
        return new Pluf_HTTP_Response_Json(
                new ArrayObject(array(
                        'success' => true
                )));
    }
520243
public function download($request, $match)
    {
        // GET data
        if (array_key_exists('modelId', $match)) {
            $content = Pluf_Shortcuts_GetObjectOr404('CMS_Content', $match['modelId']);
        } else {
            $content = CMS_Shortcuts_GetNamedContentOr404($match['name']);
        }
        // Do
        $content->downloads += 1;
        $content->update();
        $response = new Pluf_HTTP_Response_File($content->getAbsloutPath(), $content->mime_type);
        $response->headers['Content-Disposition'] = sprintf('attachment; filename="%s"', $content->file_name);
        return $response;
    }
865490
public function find_users($search) {
        global $DB;

        // Get list of allowed roles.
        $context = context_course::instance($this->courseid);
        if ($validroleids = groups_get_possible_roles($context)) {
            list($roleids, $roleparams) = $DB->get_in_or_equal($validroleids, SQL_PARAMS_NAMED, 'r');
        } else {
            $roleids = " = -1";
            $roleparams = array();
        }

        // We want to query both the current context and parent contexts.
        list($relatedctxsql, $relatedctxparams) =
            $DB->get_in_or_equal($context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx');

        // Get the search condition.
        list($searchcondition, $searchparams) = $this->search_sql($search, 'u');

        // Build the SQL.
        list($enrolsql, $enrolparams) = get_enrolled_sql($context);
        $fields = "SELECT r.id AS roleid, u.id AS userid,
                          " . $this->required_fields_sql('u') . ",
                          (SELECT count(igm.groupid)
                             FROM {groups_members} igm
                             JOIN {groups} ig ON igm.groupid = ig.id
                            WHERE igm.userid = u.id AND ig.courseid = :courseid) AS numgroups";
        $sql = "   FROM {user} u
                   JOIN ($enrolsql) e ON e.id = u.id
              LEFT JOIN {role_assignments} ra ON (ra.userid = u.id AND ra.contextid $relatedctxsql AND ra.roleid $roleids)
              LEFT JOIN {role} r ON r.id = ra.roleid
              LEFT JOIN {groups_members} gm ON (gm.userid = u.id AND gm.groupid = :groupid)
                  WHERE u.deleted = 0
                        AND gm.id IS NULL
                        AND $searchcondition";

        list($sort, $sortparams) = users_order_by_sql('u', $search, $this->accesscontext);
        $orderby = ' ORDER BY ' . $sort;

        $params = array_merge($searchparams, $roleparams, $enrolparams, $relatedctxparams);
        $params['courseid'] = $this->courseid;
        $params['groupid']  = $this->groupid;

        if (!$this->is_validating()) {
            $potentialmemberscount = $DB->count_records_sql("SELECT COUNT(DISTINCT u.id) $sql", $params);
            if ($potentialmemberscount > $this->maxusersperpage) {
                return $this->too_many_results($search, $potentialmemberscount);
            }
        }

        $rs = $DB->get_recordset_sql("$fields $sql $orderby", array_merge($params, $sortparams));
        $roles = groups_calculate_role_people($rs, $context);

        // Don't hold onto user IDs if we're doing validation.
        if (empty($this->validatinguserids) ) {
            if ($roles) {
                foreach ($roles as $k => $v) {
                    if ($v) {
                        foreach ($v->users as $uid => $userobject) {
                            $this->potentialmembersids[] = $uid;
                        }
                    }
                }
            }
        }

        return $this->convert_array_format($roles, $search);
    }
277156
public static function delete($request, $match)
    {
        if (array_key_exists('userId', $match)) {
            // Check user is owner
            if ($request->user->id != $match['userId'] && !User_Precondition::isOwner($request)) {
                throw new Pluf_Exception_Forbidden('Not allowed to change others avatar');
            }
            $user = Pluf_Shortcuts_GetObjectOr404('User_Account', $match['userId']);
        } else {
            $user = $request->user;
        }
        if($user->isAnonymous()){
            throw new Pluf_Exception_BadRequest('User is not defined');
        }
        return User_Shortcuts_DeleteAvatar($user);
    }
383497
public function tags ($request, $match)
    {
        $location = Geo_Shortcuts_GetLocationOr404($match[1]);
        Geo_Precondition::canEditLocation($request, $location);
        // Pluf pagination
        $pag = new Pluf_Paginator(new SaaSKM_Tag());
        $pag->model_view = 'join_row';
        $pag->forced_where = new Pluf_SQL(
                'saaskm_tag.tenant=%s AND owner_class=%s AND owner_id=%s', 
                array(
                        $request->tenant->id,
                        $location->_a['model'],
                        $location->id
                ));
        $list_display = array(
                'title' => __('location title'),
                'description' => __('description')
        );
        $search_fields = array(
                'name',
                'description'
        );
        $sort_fields = array(
                'creation_date',
                'modif_dtime'
        );
        $pag->configure($list_display, $search_fields, $sort_fields);
        $pag->sort_order = array(
                'creation_dtime',
                'DESC'
        );
        $pag->setFromRequest($request);
        return new Pluf_HTTP_Response_Json($pag->render_object());
    }
1047890
public static function get($request, $match)
    {
        $perm = Pluf_Shortcuts_GetObjectOr404('User_Role', $match['role_id']);
        $groupModel = new User_Group();
        $param = array(
            'view' => 'join_role',
            'filter' => array(
                'id=' . $match['group_id'],
                'role_id=' . $perm->id
            )
        );
        $groups = $groupModel->getList($param);
        if ($groups->count() == 0) {
            throw new Pluf_Exception_DoesNotExist('Group has not such role');
        }
        return $groups[0];
    }
942369
public function find($request, $match)
    {
        $builder = new Pluf_Paginator_Builder(new CMS_Content());
        return $builder->setRequest($request)->build();
    }
617558
public function logout($request, $match)
    {
        $request->user = new User_Account();
        $request->session->clear();
        $request->session->setData('logout_time', gmdate('Y-m-d H:i:s'));
        return $request->user;
    }
17885
def _parse_users(self, match):
        ''''''

        # Don't parse lists here
        if match.group(2) is not None:
            return match.group(0)

        mat = match.group(0)
        if self._include_spans:
            self._users.append((mat[1:], match.span(0)))
        else:
            self._users.append(mat[1:])

        if self._html:
            return self.format_username(mat[0:1], mat[1:])
1122090
public function get($request, $match)
    {
        $userId = $match['userId'];
//         $user = Pluf_Shortcuts_GetObjectOr404('User', $userId);
//         try {
//             $profile = $user->getProfile();
//         } catch (Pluf_Exception_DoesNotExist $ex) {
//             $profile = new $profile_model();
//             $profile->user = $user;
//             $profile->create();
//         }
//         return new Pluf_HTTP_Response_Json($profile);
        $profileDoc = User_Views_CProfile::get_profile_document($userId);
        $docMap = User_Views_CProfile::getDocumentMap($profileDoc);
        $docMap['user'] = $userId;
        return new Pluf_HTTP_Response_Json($docMap);
    }