diff options
author | Chris Cornutt <chris.cornutt@hp.com> | 2014-12-16 11:54:46 -0600 |
---|---|---|
committer | Chris Cornutt <chris.cornutt@hp.com> | 2014-12-16 11:54:46 -0600 |
commit | 20a491b50cddc46a706465ba5abdba015cc3ba4b (patch) | |
tree | 184ab4de9687e295ee3383f8af9f8156024f3d3b /docs/users.md | |
parent | 694ea9249e2a76074ab655015a878ec567aea2ef (diff) | |
download | gatekeeper-20a491b50cddc46a706465ba5abdba015cc3ba4b.zip gatekeeper-20a491b50cddc46a706465ba5abdba015cc3ba4b.tar.gz gatekeeper-20a491b50cddc46a706465ba5abdba015cc3ba4b.tar.bz2 |
updating docs with a "common operations" page and removing that content from the other pages0.7
Diffstat (limited to 'docs/users.md')
-rw-r--r-- | docs/users.md | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/docs/users.md b/docs/users.md index dba3a32..d3dd665 100644 --- a/docs/users.md +++ b/docs/users.md @@ -46,50 +46,6 @@ Gatekeeper::register($credentials); The return value from the `register` call is a *boolean* indicating the pass/fail status of the registration. -## Finding Users - -You can use the `findByUserId` method to locate a user by their ID number: - -```php -<?php -$userId = 1; -$user = Gatekeeper::findUserById($userId); - -// Or, to get a property directly -$username = Gatekeeper::findUserById($userId)->username; -?> -``` - -The return value is an instance of the `UserModel` with the properties populated with the user data (if it was found). A `UserNotFoundException` will be thrown if the user is not found. - -Additionally, you can run a "find by" on any property in the `User` model, not just the ID value: - -```php -<?php -$user = Gatekeeper::findUserByUsername('ccornutt'); -$user = Gatekeeper::findUserByFirstName('Chris'); - -// etc... -?> -``` - -## Deleting Users - -You can delete users in much the same way you can find them. It's usually the best idea to use the `ID` (primary key) value if you're wanting to delete a specific user as that will definitely only find one user. - -```php -<?php -// This will delete the one user by ID -Gatekeeper::deleteUserById(1); - -// If there's more than one "Chris" this will return false -Gatekeeper::deleteUserByFirstName('Chris'); - -?> -``` - -If you provide details and the system finds more than one record matching it, it will return `false` and not perform the `delete` operation. - ## Activating/Deactivating Users You can mark a user as active or inactive in the system easily. Inactive users will not be able to log in using the `authenticate` method. Changing the user status is easy: |