NAME
OpusVL::AppKit::FormFu::Constraint::AppKitUsername
VERSION
version 2.29
SYNOPSIS
- type: Text
name: username
constraints:
- type: '+OpusVL::AppKit::FormFu::Constraint::AppKitUsername'
user_stashkey: user_for_update
DESCRIPTION
Ensures that duplicate user names aren't created.
To find existing user (the one we might be updating, therefore the username WILL exist) we check the context stash (Catalyst context) and look for stash key identified by 'user_stashkey'.
If the 'user' is in the stash, it will asume it to be a dbix object, pull its id and ignore that id when checking for existing usernames.
Adding a user.
Nothing required except and AppKitAuthDB model, which should be in every AppKit app.
Updating a user.
In the Catalyst stash there must be: 'user' - dbix object for the User.
NAME
OpusVL::AppKit::FormFu::Constraint::AppKitUsername - Username contraint for the AppKitAuthDB model.
METHODS
user_stashkey
Sets the key used to find an existing user in the context stash.
constrain_value
This method is used by formfu to hook into this constraints, constraining code.
Returns: boolean - 0 = did not validate, 1 = validated
AUTHOR
OpusVL - www.opusvl.com
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by OpusVL - www.opusvl.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.