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

Switch users #205

Merged
merged 19 commits into from Apr 26, 2017
Merged

Switch users #205

merged 19 commits into from Apr 26, 2017

Conversation

@sam002
Copy link
Contributor

@sam002 sam002 commented Feb 21, 2017

Q A
Is bugfix? no
New feature? yes
Breaks BC? no
Tests pass? yes
Fixed issues #204
@samdark samdark self-assigned this Feb 21, 2017
@samdark samdark added this to the 2.0.10 milestone Feb 21, 2017
Module.php Outdated
* @see http://www.yiiframework.com/doc-2.0/guide-security-authorization.html
* @since 2.0.10
*/
public $allowedUserSwitch = [

This comment has been minimized.

@samdark

samdark Feb 22, 2017
Member

Why do we need to deny it?

This comment has been minimized.

@sam002

sam002 Feb 22, 2017
Author Contributor

Foolproof. If allowed, then will broken BC default security authorization. Access without custom settings to the panel shall not allowing user interfere with RBAC.

This comment has been minimized.

@samdark

samdark Feb 22, 2017
Member

Only developer could be logged into debug so I'm not sure it makes sense.

This comment has been minimized.

@sam002

sam002 Feb 22, 2017
Author Contributor

Unless errors not occur))

@@ -0,0 +1 @@
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 50 50" version="1.1"><path d="m41.1 23c-0.6 0-1 0.4-1 1v10.7l-25.6-0.1c0 0 0-2 0-2.8 0-0.8-0.7-1-1-0.6l-3.5 3.5c-0.6 0.6-0.6 1.3 0 2l3.4 3.4c0.4 0.4 1.1 0.2 1-0.6l0-2.9c0 0 20.8 0.1 26.6 0 0.6 0 1-0.4 1-1v-11.7c0-0.6-0.4-1-1-1zM9 26.9 9 26.9 9 26.9 9 26.9"/><path d="m9 26.9c0.6 0 1-0.4 1-1v-10.7l25.6 0.1c0 0 0 2 0 2.8 0 0.8 0.7 1 1 0.6l3.5-3.5c0.6-0.6 0.6-1.3 0-2l-3.4-3.4c-0.4-0.4-1.1-0.2-1 0.6l0 2.9c0 0-20.8-0.1-26.6 0-0.6 0-1 0.4-1 1v11.7c0 0.6 0.4 1 1 1z"/></svg>

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

Doesn't seem to be used anywhere.

This comment has been minimized.

@samdark

samdark Feb 25, 2017
Member

OK, let's have it then.

use yii\web\Response;

/**
* Debugger controller

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

It is user controller.

* Debugger controller
*
* @author Semen Dubina <yii2debug@sam002.net>
* @since 2.0

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

Next version should be used.

Settable: _allow, roles, ips, matchCallback, denyCallback_.
For detail see [Guide Authorization](http://www.yiiframework.com/doc-2.0/guide-security-authorization.html)

Checks a main user access, not current!

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

This line is not clear. What was meant here?

'panels' => [
'user' => [
'class'=>'yii\debug\panels\UserPanel',
'ruleSwitch' => [

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

ruleUserSwitch

private $user;

/**
* @var User

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

Need phpdoc.

public $userSwitch;

/**
* @var string|\yii\web\User Implements of User model with _search()_ method.

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

Should be required explicitly via interface.

]);
echo $formSet->field(
$panel->userSwitch->getUser()->identity,
'id', ['options' => ['class' => '']])->textInput(['id' => 'user_id', 'name' => 'user_id'])

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

This line causes error in case Indentity isn't an AR. Try using toolbar in basic application template.

echo Html::submitButton('Switch', ['class' => 'btn btn-primary']);
ActiveForm::end();

$script = <<< JS

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

Could it be moved to assets?

'</span>', ['class' => 'btn btn-default']);
ActiveForm::end();

$scriptReset = <<< JS

This comment has been minimized.

@samdark

samdark Feb 24, 2017
Member

Could it be moved to assets?

sam002 and others added 3 commits Feb 26, 2017
…s on UserPanel, fix requested changes.
@samdark
Copy link
Member

@samdark samdark commented Feb 26, 2017

Code looks good to me overall. Naming isn't perfect though.

qip shot - screen 565

@samdark
Copy link
Member

@samdark samdark commented Apr 24, 2017

Please add a line for changelog.

@sam002
Copy link
Contributor Author

@sam002 sam002 commented Apr 24, 2017

@samdark, done.

@samdark samdark merged commit 959a651 into yiisoft:master Apr 26, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@samdark
Copy link
Member

@samdark samdark commented Apr 26, 2017

Merged. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.