UserFrosting API

GroupController extends SimpleController

Controller class for group-related requests, including listing groups, CRUD for groups, etc.

Basic controller class, that imports the entire DI container for easy access to services. Your controller classes may extend this controller class.

Tags
author

Alex Weissman (https://alexanderweissman.com)

Table of Contents

$ci ContainerInterface
create() Processes the request to create a new group. mixed
delete() Processes the request to delete an existing group. mixed
getInfo() Returns info for a single group. mixed
getList() Returns a list of Groups. mixed
getModalConfirmDelete() Get deletetion confirmation modal. mixed
getModalCreate() Renders the modal form for creating a new group. mixed
getModalEdit() Renders the modal form for editing an existing group. mixed
getUsers() Users List API. mixed
pageInfo() Renders a page displaying a group's information, in read-only mode. mixed
pageList() Renders the group listing page. mixed
updateInfo() Processes the request to update an existing group's details. mixed
getGroupFromParams() Get group from params. Group
__construct() Constructor. mixed

Properties

Methods

create()

Processes the request to create a new group.

public create( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

Processes the request from the group creation form, checking that:

  1. The group name and slug are not already in use;
  2. The user has permission to create a new group;
  3. The submitted data is valid. This route requires authentication (and should generally be limited to admins or the root user).

Request type: POST

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
see
getModalCreateGroup
throws
ForbiddenException

If user is not authozied to access page

Return values
mixed

delete()

Processes the request to delete an existing group.

public delete( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

Deletes the specified group. Before doing so, checks that:

  1. The user has permission to delete this group;
  2. The group is not currently set as the default for new users;
  3. The group is empty (does not have any users);
  4. The submitted data is valid. This route requires authentication (and should generally be limited to admins or the root user).

Request type: DELETE

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
NotFoundException

If group is not found

throws
ForbiddenException

If user is not authozied to access page

throws
BadRequestException
Return values
mixed

getInfo()

Returns info for a single group.

public getInfo( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

This page requires authentication.

Request type: GET

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
ForbiddenException

If user is not authozied to access page

throws
NotFoundException

If group is not found

Return values
mixed

getList()

Returns a list of Groups.

public getList( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

Generates a list of groups, optionally paginated, sorted and/or filtered. This page requires authentication.

Request type: GET

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
ForbiddenException

If user is not authozied to access page

Return values
mixed

getModalConfirmDelete()

Get deletetion confirmation modal.

public getModalConfirmDelete( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed
Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
NotFoundException

If group is not found

throws
ForbiddenException

If user is not authozied to access page

throws
BadRequestException
Return values
mixed

getModalCreate()

Renders the modal form for creating a new group.

public getModalCreate( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

This does NOT render a complete page. Instead, it renders the HTML for the modal, which can be embedded in other pages. This page requires authentication.

Request type: GET

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
ForbiddenException

If user is not authozied to access page

Return values
mixed

getModalEdit()

Renders the modal form for editing an existing group.

public getModalEdit( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

This does NOT render a complete page. Instead, it renders the HTML for the modal, which can be embedded in other pages. This page requires authentication.

Request type: GET

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
NotFoundException

If group is not found

throws
ForbiddenException

If user is not authozied to access page

Return values
mixed

getUsers()

Users List API.

public getUsers( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed
Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
NotFoundException

If group is not found

throws
ForbiddenException

If user is not authozied to access page

Return values
mixed

pageInfo()

Renders a page displaying a group's information, in read-only mode.

public pageInfo( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

This checks that the currently logged-in user has permission to view the requested group's info. It checks each field individually, showing only those that you have permission to view. This will also try to show buttons for deleting, and editing the group. This page requires authentication.

Request type: GET

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
ForbiddenException

If user is not authozied to access page

Return values
mixed

pageList()

Renders the group listing page.

public pageList( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

This page renders a table of groups, with dropdown menus for admin actions for each group. Actions typically include: edit group, delete group. This page requires authentication.

Request type: GET

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
throws
ForbiddenException

If user is not authozied to access page

Return values
mixed

updateInfo()

Processes the request to update an existing group's details.

public updateInfo( $request : ServerRequestInterface , $response : ResponseInterface , $args : array ) : mixed

Processes the request from the group update form, checking that:

  1. The group name/slug are not already in use;
  2. The user has the necessary permissions to update the posted field(s);
  3. The submitted data is valid. This route requires authentication (and should generally be limited to admins or the root user).

Request type: PUT

Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$args : array
Tags
see
getModalGroupEdit
throws
NotFoundException

If group is not found

throws
ForbiddenException

If user is not authozied to access page

Return values
mixed

__construct()

Constructor.

public __construct( $ci : ContainerInterface ) : mixed
Parameters
$ci : ContainerInterface

The global container object, which holds all your services.

Return values
mixed

Search results