Permalink
Browse files

Extend usage where Auth model is in another plugin

I expect this to be a fairly common situation.
For example when integrating the CakeDC Users plugin
https://github.com/CakeDC/users
  • Loading branch information...
1 parent cca71bd commit 41d4d51809f12bc20f32f8c8294cd6b63bc626e9 @mcallisto mcallisto committed Nov 21, 2012
Showing with 11 additions and 2 deletions.
  1. +11 −2 Controller/Component/ConnectComponent.php
@@ -56,6 +56,11 @@ class ConnectComponent extends Component {
* set to model alias to init the model.
*/
public $model = false;
+
+ /**
+ * name of the plugin containing the authentication model, if any; false by default.
+ */
+ public $plugin = false;
/**
* Fields for the model if you want to save the Auth component.
@@ -228,8 +233,12 @@ private function __runCallback($callback, $passedIn = null){
*/
private function __initUserModel(){
if($this->model){
- App::uses($this->model,'Model');
- $this->User = ClassRegistry::init($this->model);
+ $plugin = '';
+ if ($this->plugin) {
+ $plugin = $this->plugin.'.';
+ }
+ App::uses($this->model, $plugin.'Model');
+ $this->User = ClassRegistry::init($plugin.$this->model);
}
if (isset($this->User)) {
$this->User->recursive = -1;

0 comments on commit 41d4d51

Please sign in to comment.