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

Added disabledActions feature to SecurityComponent #750

Merged
merged 2 commits into from
Aug 6, 2012

Conversation

tigrang
Copy link
Contributor

@tigrang tigrang commented Aug 2, 2012

Disables security checks if action is defined in disabledActions

For the lazy ones :]

@lorenzo
Copy link
Member

lorenzo commented Aug 2, 2012

Sounds like a reasonable idea, let's hear what the other have to say about this

$this->Controller->request->data = array('data');
$this->Controller->Security->disabledActions = 'index';
$this->Controller->Security->blackHoleCallback = null;
$this->Controller->Security->startup($this->Controller);
Copy link
Member

Choose a reason for hiding this comment

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

A test with no assertions and no annotations looks like a mistake, perhaps add a comment, or assertion ensuring this isn't a mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea was that if it throws an exception it was blackholed (which it shouldn't be since its disabled for the current) action and that would cause the test to fail otherwise it passes. Is a try/catch block preferred with an assertion at the end to test that exception wasn't thrown, a comment, or $this->fail('Action was blackholed when it should not have been'); inside of the catch block?

Copy link
Member

Choose a reason for hiding this comment

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

You could just $this->assertNull() the return of startup().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done.

@markstory
Copy link
Member

I like the ability to declaratively disable the checks.

@ADmad
Copy link
Member

ADmad commented Aug 3, 2012

I don't like the property name. Just by name my first impression would be it is used to disallow/block actions when in fact it does the opposite. It would be better to rename it to unlockedActions similar to the unlockedFields.

@dereuromark
Copy link
Member

Admad: that sounds reasonable. I had the same first impression with disabledActions

@tigrang
Copy link
Contributor Author

tigrang commented Aug 3, 2012

I don't know what you guys are talking about. disabledActions is a fluffin awesome property name. =P

For consistency's sake, I think unlockedActions works better.

@sitedyno
Copy link
Contributor

sitedyno commented Aug 3, 2012

unCheckedActions or possibly checksDisabled ?

@markstory
Copy link
Member

I think this looks good to merge in, are there any other changes that need to be made @lorenzo?

@lorenzo
Copy link
Member

lorenzo commented Aug 6, 2012

Seems good to me, I'll merge it in

lorenzo added a commit that referenced this pull request Aug 6, 2012
Added `disabledActions` feature to SecurityComponent
@lorenzo lorenzo merged commit 1ff6375 into cakephp:2.3 Aug 6, 2012
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.

6 participants