The application delegate class is similar to the table_delegate_class except that it is applicable to the application as a whole, not just one table. It allows the developer to implement hooks that will be executed by Xataface to modify behavior.
Examples of customizations that can be made with the Application Delegate class include:
Permissions
User Preferences
Custom content to be inserted into templates.
Triggers
more.
Location
The delegate class is optional and should be located in the conf/ApplicationDelegate.php file in the application directory.
Example
<?php
class conf_ApplicationDelegate {
function getPermissions(&$record){
return Dataface_PermissionsTool::NO_ACCESS();
}
}
Available Methods
Triggers
Name
Description
Version
after_action_activate
Trigger called after activation is complete. Activation occurs after a user registers and responds to the registration confirmation email.
Trigger called just before authentication is carried out. This allows you to change the authentication type based on such things as SESSION variables etc...
Trigger called on each page request immediately before the action handler is called. This is handy if you need to perform some action on each page request, such as changing the default action depending on the logged in user.
If implemented, this overrides how Xataface starts its sessions. If you implement this method, your custom method should at least include a call to session_start.
1.2.5
Preferences
Name
Description
Version
getPreferences
Returns the user preference settings.
0.6
Permissions
Name
Description
Version
getPermissions
Returns the permissions available for a given record.
0.6
getRoles
Returns the roles allowed for a given record.
1.0
__field__permissions
Returns the default permissions for a field of a given record.
1.0
__field__roles
Returns the default roles for a field of a given record.
1.0
fieldname__permissions
Returns the permissions that are allowed for the field "fieldname" on a given record.
0.7
fieldname__roles
Returns the roles that are allowed for the field "fieldname" on a given record.
1.0
rel_relationshipname__permissions
Returns the permissions pertaining to the relationship relationshipname on a given record.
1.0
rel_relationshiopname__roles
Returns the role or roles pertaining to the relationship relationshipname on a given record.
1.0
See permissions? for more information about Xataface's permissions architecture and how to implement custom application permissions.
Optional method to define the settings for the email that is sent to the user upon successful resetting of their password using the password reset function.
Optional method to define the settings for the email that is sent when a user requests to reset their password. This step comes before the password changed email as first the user requests a password reset and receives this email. Then they click a link in this email to reset the password upon which time they receive a second email containing their temporary password. That email is generated by the getPasswordChangedEmailInfo method if defined. If this method is not defined then a generic email predefined in Xataface will be sent instead.
Returns a unique user id that is used by the output cache to ensure that different users don't use the same cached page (unless appropriate). This is generally not necessary as the output cache by default uses a different cache for each user... but in some cases you may want to use a different cache for the same user.