Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The page isn't redirecting properly #36

Closed
tahiryasin opened this issue Feb 13, 2013 · 9 comments
Closed

The page isn't redirecting properly #36

tahiryasin opened this issue Feb 13, 2013 · 9 comments

Comments

@tahiryasin
Copy link

After enabling module it shows me "The page isn't redirecting properly" and site is no longer accessible.

Here is config file http://codepad.org/ux4fCtEm

and here main controller class http://codepad.org/GFoPJn1s

@softark
Copy link
Contributor

softark commented Feb 20, 2013

I think it's because you have not allowed the guests (anonymous users) to access the login page.

@tahiryasin
Copy link
Author

@softark thanks for your reply but that is what I want to know, can you please tell me how can I allow guests for some actions?

@softark
Copy link
Contributor

softark commented Feb 20, 2013

Probably you have to do the following:

  1. Create a role 'guest' for the guest users.
  2. Define 'guest' as a default role.
  3. Create an operation 'site.login' for the login page. ... I assume that your login page is 'in 'site' controller and the action is 'login'.
  4. Add 'site.login' operation as a child to 'guest' role.

@mve-it-solutions
Copy link
Contributor

How do you define role 'guest' as default role? I can't use defaultRoles in main.php within array authManager

@softark
Copy link
Contributor

softark commented Feb 20, 2013

As you see in the guide, you can define the default roles in the config file.
http://www.yiiframework.com/doc/guide/1.1/en/topics.auth#using-business-rules

And, well, I think the 'guest' role won't need a business rule, because everyone should have the rights as a guest.

@softark
Copy link
Contributor

softark commented Feb 21, 2013

Ah, I've found another simple solution in a comment of auth extension.
You can just exclude the actions for the guests from the filter.

public function filters()
{
    return array(
        array('auth.filters.AuthFilter - login, test'),
    );
}

http://www.yiiframework.com/extension/auth/#c11979

@mve-it-solutions
Copy link
Contributor

I mean, this won't work
[protected/config/main.php]


        'authManager'=>array(
            'defaultRoles'=>array('guest'),
            'behaviors' => array(
                array(
                    'class'=>'auth.components.AuthBehavior',
                    'admins' => array('admin'), // a list of users who has access to the module.
                ),
            ),
        ),

[protected/components/controller.php]
add:


    public function filters()
    {
        return array(
            array('auth.filters.AuthFilter'),
        );
    }

add role guest using yii-auth with operation site.*
operation user.login.* (yii-user module)

I get error:
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

@softark
Copy link
Contributor

softark commented Feb 25, 2013

Sorry, I think this "issue" should be closed.
This is not a good place for discussing this kind of problems. The forum is more appropriate for them.

@mve-it-solutions
Copy link
Contributor

This did the trick #53.
Thanks m-nel ;-)

@crisu83 crisu83 closed this as completed Sep 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants