## AgsController

AgsController — base controller

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | AGS_CONTROLLER_GET_OBJ_MUTEX()
AgsControllerResource * | ags_controller_resource_alloc ()
void | ags_controller_resource_free ()
void | ags_controller_resource_ref ()
void | ags_controller_resource_unref ()
void | ags_controller_add_resource ()
void | ags_controller_remove_resource ()
AgsControllerResource * | ags_controller_lookup_resource ()
gboolean | ags_controller_query_security_context ()
AgsController * | ags_controller_new ()

## Properties

char * | context-path | Read / Write
AgsServer * | server | Read / Write

## Types and Values

#define | AGS_CONTROLLER_BASE_PATH
struct | AgsControllerResource

## Object Hierarchy

        GObject
        ╰── AgsController
            ╰── AgsFrontController

## Includes

    #include <ags/server/controller/ags_controller.h>

## Description

The AgsController is a base object to implement controllers.

## Functions

### AGS_CONTROLLER_GET_OBJ_MUTEX()

    #define AGS_CONTROLLER_GET_OBJ_MUTEX(obj) (&(((AgsController *) obj)->obj_mutex))

### ags_controller_resource_alloc ()

    AgsControllerResource *
    ags_controller_resource_alloc (gchar *group_id,
                                   gchar *user_id,
                                   guint access_mode);

Allocated AgsControllerResource.

#### Parameters

group_id | the group id |
user_id | the user id |
access_mode | the access mode |

#### Returns

the newly allocated AgsControllerResource.

[type gpointer][transfer none]

Since: 3.0.0

### ags_controller_resource_free ()

    void
    ags_controller_resource_free (AgsControllerResource *controller_resource);

Free `controller_resource` .

#### Parameters

controller_resource | the AgsControllerResource. | [type gpointer]

Since: 3.0.0

### ags_controller_resource_ref ()

    void
    ags_controller_resource_ref (AgsControllerResource *controller_resource);

Increase ref-count of `controller_resource` .

#### Parameters

controller_resource | the AgsControllerResource. | [type gpointer]

Since: 3.0.0

### ags_controller_resource_unref ()

    void
    ags_controller_resource_unref (AgsControllerResource *controller_resource);

Decrease ref-count of `controller_resource` and free it if ref-count drops to 0.

#### Parameters

controller_resource | the AgsControllerResource. | [type gpointer]

Since: 3.0.0

### ags_controller_add_resource ()

    void
    ags_controller_add_resource (AgsController *controller,
                                 gchar *resource_name,
                                 AgsControllerResource *controller_resource);

Add `controller_resource` with key `resource_name` to hash table.

#### Parameters

controller | the AgsController |
resource_name | the resource name as string |
controller_resource | the AgsControllerResource. | [type gpointer]

Since: 3.0.0

### ags_controller_remove_resource ()

    void
    ags_controller_remove_resource (AgsController *controller,
                                    gchar *resource_name);

Remove key `resource_name` from hash table.

#### Parameters

controller | the AgsController |
resource_name | the resource name as string |

Since: 3.0.0

### ags_controller_lookup_resource ()

    AgsControllerResource *
    ags_controller_lookup_resource (AgsController *controller,
                                    gchar *resource_name);

Lookup key `resource_name` in hash table.

#### Parameters

controller | the AgsController |
resource_name | the resource name as string |

#### Returns

the matching AgsControllerResource.

[type gpointer][transfer none]

Since: 3.0.0

### ags_controller_query_security_context ()

    gboolean
    ags_controller_query_security_context (AgsController *controller,
                                           GObject *security_context,
                                           gchar *login);

Query `security_context` for `login` .

#### Parameters

controller | the AgsController |
security_context | the AgsSecurityContext |
login | the login to query |

#### Returns

`TRUE` if allowed to proceed, otherwise `FALSE`

Since: 3.0.0

### ags_controller_new ()

    AgsController *
    ags_controller_new ();

Instantiate new AgsController

#### Returns

the AgsController

Since: 3.0.0

## Types and Values

### AGS_CONTROLLER_BASE_PATH

    #define AGS_CONTROLLER_BASE_PATH "/ags-xmlrpc"

### struct AgsControllerResource

    struct AgsControllerResource {
      gint ref_count;

      gchar *group_id;
      gchar *user_id;

      guint access_mode;
    };

Specifing attributes of resources.

#### Members

gint `ref_count`; | the reference count |
gchar *`group_id`; | the group id of permissions |
gchar *`user_id`; | the user id of permissions |
guint `access_mode`; | the access mode of permissions |

## Property Details

### The `“context-path”` property

      “context-path”             char *

The context path provided.

Owner: AgsController

Flags: Read / Write

Default value: NULL

Since: 3.0.0

### The `“server”` property

      “server”                   AgsServer *

The assigned AgsServer

Owner: AgsController

Flags: Read / Write

Since: 3.0.0