-
Notifications
You must be signed in to change notification settings - Fork 506
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
Adding fix for Role feature state check #2851
Conversation
@willdoran if you use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the validation changes are incomplete - needs to be added to rules.
I assume Create validator inherits from Update so this blocks creating new roles too?
src/App/Validator/Role/Update.php
Outdated
@@ -36,6 +38,15 @@ protected function getRules() | |||
]; | |||
} | |||
|
|||
public function checkRolesEnabled(\Kohana\Validation\Validation $validation, $permissions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of things:
- Don't you need to add this into
getRules
above? - Should updates fail entirely? or should we be able to rename roles in the free tier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realised this is going back to the lumen branch. You need to change the interface to rely on Ushahidi\Core\Tool\ValidationEngine
instead. It should work as written otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should updates fail entirely? or should we be able to rename roles in the free tier?
nope no changes to roles at all allowed
Don't you need to add this into getRules above?
yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to change the interface to rely on Ushahidi\Core\Tool\ValidationEngine instead.
Can you link an example from the other validators, not sure I follow.
@rjmackay Yeah I think that will work, will add it. |
#ush022 - check that checkRolesEnabled returns what we expect
@rjmackay could you peak at this again when you have a second? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
*/ | ||
class RoleUpdateTest extends TestCase | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we should add a test that actually calls Update::check() with some data too.
Notes
I'm not certain how to test this in the integration tests since we can't alter the features via request and I don't immediately see a way to do it from the tests.
This pull request makes the following changes:
Test checklist:
With Roles feature enabled set to false
Attempt to create/update a new role via HTTP Post
You should receive a 422
I certify that I ran my checklist
Fixes #1617
Ping @ushahidi/platform