# |
May 26th 2017, 12:34 |
eax |
hmic: I'm unsure if this test is enough: https://gist.github.com/eaxexe/775ab0043c6822065ba56645f0cfb64d (Which fails) - I have made a repo on github that reproduces the error, and added this test to ArticlesTableTest.php - Is it acceptable to make the issue and refer to that repo, as for showing how to reproduce it? :) |
# |
May 26th 2017, 12:34 |
inoas |
so there was something built-in already :) |
# |
May 26th 2017, 12:34 |
inoas |
->add('output_content_type', 'equalTo', ['rule' => ['equalTo', 'INHERIT'], 'on' => function ($context) { return $context['data']['kind'] !== 'DOCUMENT'; }]); - works like a charm |
# |
May 26th 2017, 12:33 |
obinoob |
hmic well I first though of ACL but not sure... I've also read https://github.com/burzum/cakephp-simple-rbac it's not definitely what I need I could easily achieve that with authorise method |
# |
May 26th 2017, 12:31 |
hmic |
you can easily roll a completely custom authorization class too of course. if thats what you like to do... |
# |
May 26th 2017, 12:31 |
hmic |
thats eighter rbac or acl with me. depending on the degree of controll you want |
# |
May 26th 2017, 12:29 |
obinoob |
hmic: for example user can only add if he meets a few requirements... authorization yes but with a refined degree |
# |
May 26th 2017, 12:25 |
hmic |
plugins for both do exist |
# |
May 26th 2017, 12:25 |
obinoob |
hmic you're probably right about it |
# |
May 26th 2017, 12:25 |
hmic |
if thats not enough, you will need a full blown ACL solution |
# |
May 26th 2017, 12:25 |
hmic |
the first thing to consider, besides hardcoded groups of users, is RBAC authorization |
# |
May 26th 2017, 12:25 |
obinoob |
I also learned that components will not need view components or a build up responses right? |
# |
May 26th 2017, 12:25 |
hmic |
probably you are looking for authorization stuff? not validation? |
# |
May 26th 2017, 12:23 |
obinoob |
whats my best options to validate an action based on business rules I mean besides the form validation on CRUD, what if I need to verify if user meets requirements before he does something and requirements meet a few validation rules? I'm starting to think that must be a very unique way of doing this or i will end up hacking the framework and thus fighting a lot of concepts... |
# |
May 26th 2017, 12:11 |
NeoTherm1c|Work |
Yep |
# |
May 26th 2017, 12:11 |
inoas |
https://book.cakephp.org/3.0/en/core-libraries/validation.html#conditional-validation |
# |
May 26th 2017, 12:11 |
inoas |
Neon1024: NeoTherm1c|Work this should do the trick shouldnt it |
# |
May 26th 2017, 11:46 |
inoas |
okay |
# |
May 26th 2017, 11:46 |
inoas |
thought there may be something |
# |
May 26th 2017, 11:45 |
Neon1024 |
inoas: I agree with NeoTherm1c|Work |
# |
May 26th 2017, 11:43 |
obinoob |
hmic: I've only wrote a component because I've found that I can only validate controller action on crud methods under buildRules, but I can't validate business rules within validation so... now i need to retrieve a response from my component which requires Flash component I'm sure I'm doing something terrible wrong |
# |
May 26th 2017, 11:36 |
NeoTherm1c|Work |
custom validation function? |
# |
May 26th 2017, 11:35 |
inoas |
on save |
# |
May 26th 2017, 11:35 |
inoas |
how do I best validate if field = FOO another field must be BAR |
# |
May 26th 2017, 11:33 |
hmic |
so load it there - you can do so from the component scope by accessing the controller it is attached to |
# |
May 26th 2017, 11:33 |
hmic |
not the component needs the flashcomponent, but the controller |
# |
May 26th 2017, 11:32 |
obinoob |
hmic: I've converted my trait to a component, I need Flash in my new component is that possible? If yes how can I load it? |
# |
May 26th 2017, 11:31 |
eax |
Good point! Thanks :) |
# |
May 26th 2017, 11:31 |
hmic |
if not, provide a testcase - based on the one thats there - that does and fails |
# |
May 26th 2017, 11:30 |
hmic |
you should check the testcase mark has added for the issue and if that fits your case |
# |
May 26th 2017, 11:25 |
eax |
That's the "old" issue, which I can still reproduce :) |
# |
May 26th 2017, 11:24 |
eax |
hmic: https://github.com/cakephp/cakephp/issues/10633 |
# |
May 26th 2017, 11:24 |
hmic |
eax: post a link to the issue please |
# |
May 26th 2017, 11:24 |
eax |
Thanks! :) |
# |
May 26th 2017, 11:24 |
hmic |
of course |
# |
May 26th 2017, 11:23 |
cleptric |
Both ^^ |
# |
May 26th 2017, 11:23 |
eax |
Okay, thanks cleptric! Should I refer to the original issue and pr, or? :) |
# |
May 26th 2017, 11:23 |
hmic |
does not need to be in the initialize method |
# |
May 26th 2017, 11:23 |
hmic |
obinoob, from any controller context. not from a table context of course where a behavior would get attached |
# |
May 26th 2017, 11:22 |
obinoob |
hmic: I think I would have to use initialize method right? |
# |
May 26th 2017, 11:22 |
cleptric |
@eax Simply open another issue :slightly_smiling_face: |