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

login time expired #13

Open
paskuale75 opened this issue Sep 12, 2021 · 9 comments
Open

login time expired #13

paskuale75 opened this issue Sep 12, 2021 · 9 comments

Comments

@paskuale75
Copy link

When the time expires and the user is no longer logged in, elfinder continues to do operations as if nothing happened.

@simialbi
Copy link
Owner

Hi @paskuale75
Yes, that's because the controller has no access behaviors registered by default. If you'd like to change this, I think it's the easiest why you register them via app config.

@paskuale75
Copy link
Author

Hi @paskuale75
Yes, that's because the controller has no access behaviors registered by default. If you'd like to change this, I think it's the easiest why you register them via app config.

Thanks @simialbi register them via app config, have you small example for this ?

@simialbi
Copy link
Owner

It should work like this (untested):

    'components' => [
        // ...
    ],
    'container' => [
        'definitions' => [
            'simialbi\yii2\elfinder\controllers\ConnectionController' => [
                'as access' => [
                    'class' => 'yii\filters\AccessControl',
                    'rules' => [
                        [
                            'allow' => true,
                            'actions' => ['index'],
                            'roles' => ['@']
                        ]
                    ]
                ]
            ]
        ]
    ]

@paskuale75
Copy link
Author

ok @simialbi I will try as you advised me, two questions:

  1. could you add it as an option in the component and the second...
  2. where can I learn more about the possibility of managing this container ?

Thanks

@simialbi
Copy link
Owner

  1. It would be misplaced there. Access control is always done via controllers
  2. here

@paskuale75
Copy link
Author

Thanks @simialbi it works fine, only one thing being a response json does not redirect at login but returns the message 403 forbidden, do you have any advice to redirect the login page when the session expires ?

@simialbi
Copy link
Owner

It's not this easy. The problem here is, that it's not a regular pjax request from the framework which would redirect if a 301 header is sent. It's an ajax request from elfinder.js itself...

@paskuale75
Copy link
Author

Therefore the only hope is to have this attitude from inside the component ? Thanks

@simialbi
Copy link
Owner

Would that really change anything? If the mask is already rendered, you'll see the exact same behavior, don't you?

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

2 participants