Yii Framework Forum: [MODULE] HybridAuth - Yii Framework Forum

Jump to content

  • (7 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[MODULE] HybridAuth Rate Topic: ***** 2 Votes

#21 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 15 July 2012 - 05:28 PM

View Postjacmoe, on 15 July 2012 - 04:03 PM, said:

Good question. :)

Perhaps a behavior?

Could either be controller behavior or model behavior. Or perhaps even both?

That would probably be the best way to do it.
And ensure that it will coexist with other extensions.


I'm a newbie to Yii but reasonably experienced in general OOP development, and it sounds odd to me. The OOP idea of classes extending each other is that they are related. eg
class Dog extends Mammal 

A Controller extending a Module is different to this principle, or even the base controller extending a modules controller is upside down. Bit more like:
class Fish extends Dog 

:lol:

If all you want is the class functions to be available to all controllers, why not just do
Yii:app->getModule()->...

in your controllers?

I haven't got to behaviours yet in my reading so I won't say anything more!
0

#22 User is offline   Mirocow 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 06-September 11

Posted 15 July 2012 - 06:30 PM

Please hare it on Github
About me: www.mirocow.com
My contributions for Yii:
0

#23 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 16 July 2012 - 12:04 PM

View Postmarkvr, on 15 July 2012 - 05:28 PM, said:

I'm a newbie to Yii but reasonably experienced in general OOP development, and it sounds odd to me. The OOP idea of classes extending each other is that they are related. eg
class Dog extends Mammal 

A Controller extending a Module is different to this principle, or even the base controller extending a modules controller is upside down. Bit more like:
class Fish extends Dog 

:lol:


Upside down, how?

A controller is a controller, no matter where it is.

However, by letting a module depend on the user extend from a base controller (from the module) is problematic if the user has several extensions which depends on it.

Behaviors and filters, on the other hand, can be chained together, which is why I think it's better.
You raised the question yourself: What if several modules wants you to make use of a base controller provided by them?

View Postmarkvr, on 15 July 2012 - 05:28 PM, said:

If all you want is the class functions to be available to all controllers, why not just do
Yii:app->getModule()->...

in your controllers?

If all you want is to use a component or two in your already existing auth handling code, then that's perfect and non-intrusive.
And I personally want YiiAuth/HybridAuth to provide that option.
Because I already have a working set of WebUser/WhatEver and I only need to call HybridAuth related functions, so I don't need any convenience classes/functions.
"Less noise - more signal"
0

#24 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 16 July 2012 - 01:38 PM

Well with yii auth I have all I need, I can update statuses, login users, access info etc.

Actually it's more then I need, but I would love to help the yii community because social integration is extremely popular. And if I can help yii fight vs zend/cakePhp/codeigniter/symfony2 I will :P

That is my only goal.

You two seem to be better then me about yii functions/methods etc.

And you seem to got this covered, if you want my help please pm me and I'll do my best.

Currently 90% of my work is jquery stuff, so anything, please ask for help:)
0

#25 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 16 July 2012 - 01:45 PM

Glad to see this conversation heading in the right direction! Thanks for all the work you've done already guys.

I'll interject my "requirements" here as well...I think the combo approach sounds the best to me also.

Key points: easily updateable, easy to integrate, multiple provider associations

As implemented, the YiiAuth method of extending the base controller definitely feels a little unnatural, but I don't have enough experience to know exactly why. Something less intrusive would seem to be a much better fit - maybe follow the model of some other extensions (yii-user, YUM)? I also don't see why it is necessary to extend the controller, as not every controller/action will need access to the hybrid auth methods. (that being said, I followed Sampa's instructions, and getting it working was really quite simple)

I think the extra table to store provider associations is absolutely necessary as well - this is the model that is recommended by other frameworks as well as services like janrain, gigya...etc.

Something as important as this (IMO) would benefit from the input of key players - Qiang, Samdark, mdomba...etc, as this type of extension will be exactly what people are looking for when they start to look for a new development framework.
0

#26 User is offline   Sampa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 173
  • Joined: 18-December 11
  • Location:Stockholm,Sweden

Posted 16 July 2012 - 02:24 PM

View PostPrplHaz4, on 16 July 2012 - 01:45 PM, said:

Glad to see this conversation heading in the right direction! Thanks for all the work you've done already guys.

I'll interject my "requirements" here as well...I think the combo approach sounds the best to me also.

Key points: easily updateable, easy to integrate, multiple provider associations

As implemented, the YiiAuth method of extending the base controller definitely feels a little unnatural, but I don't have enough experience to know exactly why. Something less intrusive would seem to be a much better fit - maybe follow the model of some other extensions (yii-user, YUM)? I also don't see why it is necessary to extend the controller, as not every controller/action will need access to the hybrid auth methods. (that being said, I followed Sampa's instructions, and getting it working was really quite simple)

I think the extra table to store provider associations is absolutely necessary as well - this is the model that is recommended by other frameworks as well as services like janrain, gigya...etc.

Something as important as this (IMO) would benefit from the input of key players - Qiang, Samdark, mdomba...etc, as this type of extension will be exactly what people are looking for when they start to look for a new development framework.

You point out many important things. I have been queastionig the approach yiiauth has after reading what jacmoe and markvr has written. I guess it comes down to me not knowing enough about yii. I could do alot jquery style, aslong as someone told we what I should do, what would improve hybridauth for the yii framework.
0

#27 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 16 July 2012 - 05:15 PM

So, is this going to be put up on Bitbucket or Github? :)
Would make it much easier to contribute/collaborate by means of forks, pull requests, patch queues, etc.
"Less noise - more signal"
0

#28 User is offline   Bynton 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 09-July 12

Posted 16 July 2012 - 06:36 PM

Nice module and nice features but it can be even more better by making some internet merchant account improvements.
0

#29 User is offline   hop_two 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 14-July 12

Posted 17 July 2012 - 06:42 PM

Hi Guys, I've just come to have a look at using this module, but it would appear that the upload of the hosted file has gone wrong, it's showing as 0.0kb for me.
0

#30 User is offline   NilsE 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 18-July 12

Posted 18 July 2012 - 08:14 AM

View Posthop_two, on 17 July 2012 - 06:42 PM, said:

Hi Guys, I've just come to have a look at using this module, but it would appear that the upload of the hosted file has gone wrong, it's showing as 0.0kb for me.


same problem - could you please fix that? thanks, nils
0

#31 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 18 July 2012 - 12:28 PM

View PostNilsE, on 18 July 2012 - 08:14 AM, said:

same problem - could you please fix that? thanks, nils


So it has, how odd. Reuploaded and OK now.
0

#32 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 18 July 2012 - 12:29 PM

View Postjacmoe, on 16 July 2012 - 05:15 PM, said:

So, is this going to be put up on Bitbucket or Github? :)
Would make it much easier to contribute/collaborate by means of forks, pull requests, patch queues, etc.


Will do when I've got Netbeans to work with the Git plugin...doesn't want to install at the moment...
0

#33 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 18 July 2012 - 02:20 PM

The NetBeans team uses Mercurial so that definitely works - use Mercurial and Bitbucket, then. :)
"Less noise - more signal"
0

#34 User is offline   hop_two 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 14-July 12

Posted 18 July 2012 - 05:42 PM

View Postmarkvr, on 18 July 2012 - 12:28 PM, said:

So it has, how odd. Reuploaded and OK now.


Thanks alot, I'm gonna have a play around with this now.
0

#35 User is offline   valleed 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 16-July 12

Posted 18 July 2012 - 08:17 PM

Thanks for the addon. Can you explain how I could integrate this with Yii-User please? Sorry, I'm a bit noob. I get to login from a provider, then I get redirected to the createUser view

Call to a member function getAttributes() on a non-object in /home/something/protected/modules/user/components/WebUser.php


Which refers to this:

    public function updateSession() {
        $user = Yii::app()->getModule('user')->user($this->id);
        $userAttributes = CMap::mergeArray(array(
                                                'email'=>$user->email,
                                                'username'=>$user->username,
                                                'create_at'=>$user->create_at,
                                                'lastvisit_at'=>$user->lastvisit_at,
                                           ),$user->profile->getAttributes());
        foreach ($userAttributes as $attrName=>$attrValue) {
            $this->setState($attrName,$attrValue);
        }
    }


That would be great to have a tutorial on how to integrate this wonderful addon with yii-user.

Thanks!
0

#36 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 22 July 2012 - 03:48 PM

I think it's because YiiUser replaces the User model (which extends CActiveRecord) with a Component, and that doesn't contain the method getAttributes.

So when you do:
$user = new User;
in HybridAuth you get the User component rather than model.

YiiUser does still have a User class that extends CActiveRecord though, so it depends how Yii's autoloaded resolves the classes.

I think that's what's going on anyway. If anyone has a better idea let me know!
0

#37 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 22 July 2012 - 04:07 PM

The above is wrong, I think it's probably because you're not creating a profile at the same time as the user model.
0

#38 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 22 July 2012 - 05:28 PM

A working version with multiple providers and support for YiiUser is up at https://github.com/markvr/hybridauth

It needs improving and more testing before updating the Yii exentension but if anyone is desperate for these features now then it's a start.

YiiUser Support:
You must have either NO config entries for YiiUser AND HybridAuth:withYiiUser config entry == false, OR the opposite.

i.e. what you mustn't do is HybridAuth:withYiiUser==false and also some config entries (e.g. imports etc) for YiiUser or vice versa. It will screw the autoloading up.
0

#39 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 22 July 2012 - 05:30 PM

View Postmarkvr, on 22 July 2012 - 04:07 PM, said:

The above is wrong, I think it's probably because you're not creating a profile at the same time as the user model.


To use it with YUM, you end up needing to use the register() method, which will register the user and create an assocated profile (a blank profile if no attributes are designated in the call to register(). My guess is that it is similar for Yii-User.
0

#40 User is offline   markvr 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 17-June 12

Posted 22 July 2012 - 05:31 PM

you'll need a new table as well:
CREATE TABLE IF NOT EXISTS `ha_logins` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userId` int(11) NOT NULL,
  `loginProvider` varchar(50) NOT NULL,
  `loginProviderIdentifier` varchar(100) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `loginProvider_2` (`loginProvider`,`loginProviderIdentifier`),
) ENGINE=InnoDB  ;


etc
0

Share this topic:


  • (7 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users