Skip to content

[Cookbook][Security] Update Voters: add class properties #3211

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

Merged
merged 1 commit into from
Nov 28, 2013
Merged

[Cookbook][Security] Update Voters: add class properties #3211

merged 1 commit into from
Nov 28, 2013

Conversation

krizon
Copy link
Contributor

@krizon krizon commented Nov 20, 2013

Q A
Doc fix? yes
New docs? no
Applies to 2.2 only (issue is fixed for 2.3+ in #3216)
Fixed tickets -

Added class properties.

private $request;
private $blacklistedIp;

public function __construct(Request $request, array $blacklistedIp = array())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if we should start using the request_stack?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can do that, but not for 2.2.

@wouterj
Copy link
Member

wouterj commented Nov 20, 2013

This can cause "not in scope"-errors. I haven't test this, let's wait what @weaverryan think about this. However, as of Symfony 2.3, we should use the request_stack here, as suggested by @cordoval

@krizon
Copy link
Contributor Author

krizon commented Nov 20, 2013

Good point, i can update this PR to only add the class properties since they were missing. I was a bit over-enthusiastic with the rest of the changes ;). Thanks for the feedback.

@wouterj
Copy link
Member

wouterj commented Nov 20, 2013

yeah, I think that's the best. And if you are enthousiast, you can create a PR for 2.3 using request_stack ;-)

@xabbuh
Copy link
Member

xabbuh commented Nov 20, 2013

Otherwise, you should change the service definition as well. :)

@wouterj
Copy link
Member

wouterj commented Nov 21, 2013

FYI, someone just submitted a change for 2.3 (I hope he'll correct his PR): #3216

@krizon
Copy link
Contributor Author

krizon commented Nov 22, 2013

Updated PR, only adds class properties now.

@@ -67,6 +67,9 @@ and compare the IP address against a set of blacklisted IP addresses:

class ClientIpVoter implements VoterInterface
{
private $container;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a blank line between the properties

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought it was part of PSR-2. But it turns out that this seems to be only my personal taste.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personal taste is personal 👶

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my fault

@krizon
Copy link
Contributor Author

krizon commented Nov 22, 2013

Fixed the issues reported by @xabbuh, thanks

weaverryan added a commit that referenced this pull request Nov 28, 2013
[Cookbook][Security] Update Voters: add class properties
@weaverryan weaverryan merged commit 21cc0ee into symfony:2.2 Nov 28, 2013
@weaverryan
Copy link
Member

Hi guys!

Nice work on this - I completely agree that we should use the container here and then handle it better in Symfony 2.4 with the request stack (#3220).

Thanks!

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

Successfully merging this pull request may close these issues.

5 participants