# |
Apr 30th 2021, 17:47 |
kevin.pfeifer |
So what if the given user isn't even allowed to view the entity? Shouldn't it be excluded from the API anyways? |
# |
Apr 30th 2021, 17:13 |
kevin.pfeifer |
sure, try that |
# |
Apr 30th 2021, 17:10 |
sebastiansperandio093 |
maybe this TinyMCE https://github.com/CakeDC/TinyMCE |
# |
Apr 30th 2021, 17:09 |
sebastiansperandio093 |
@kevin.pfeifer Thanks for answer. I just need an usual WYSIWYG editor...nothing special. (I'm creating a posts CRUD) |
# |
Apr 30th 2021, 16:30 |
martin |
since you don’t have the user entity or autorization component inside a entity :( |
# |
Apr 30th 2021, 16:30 |
martin |
ok, I will also think about a way to do it :) |
# |
Apr 30th 2021, 16:29 |
kevin.pfeifer |
well i have to go now but i will definitely look into that later :) |
# |
Apr 30th 2021, 16:28 |
kevin.pfeifer |
authorization conserned |
# |
Apr 30th 2021, 16:28 |
martin |
yes |
# |
Apr 30th 2021, 16:28 |
kevin.pfeifer |
so you basically need a true/false for each action that could be done for each given entity in your API |
# |
Apr 30th 2021, 16:27 |
martin |
yes I was thinking I add it to the entity so it will be exposed in api. |
# |
Apr 30th 2021, 16:27 |
kevin.pfeifer |
i thought you need it in the view |
# |
Apr 30th 2021, 16:26 |
kevin.pfeifer |
ah ok, thats why you thought of the entity |
# |
Apr 30th 2021, 16:26 |
martin |
ah yes ok, but it is a json api so not using the views |
# |
Apr 30th 2021, 16:26 |
kevin.pfeifer |
or require `cakedc/auth` and only copy the helper and you should be good |
# |
Apr 30th 2021, 16:25 |
kevin.pfeifer |
sure its based on cakedc/auth but you could basically copy the helper and the trait, adjust it to use what you need and then you are independent of cakedc if you so desire |
# |
Apr 30th 2021, 16:21 |
martin |
@kevin.pfeifer but that uses the cakedc auth, not the authorization middleware? |
# |
Apr 30th 2021, 16:15 |
kevin.pfeifer |
@sebias |
# |
Apr 30th 2021, 16:15 |
kevin.pfeifer |
@martin look at the AuthLinkHelper from CakeDC https://github.com/CakeDC/users/blob/master/src/View/Helper/AuthLinkHelper.php |
# |
Apr 30th 2021, 16:13 |
sebastiansperandio093 |
Could someone to suggest the best option for wysiwyg editor in cakephp 4? |
# |
Apr 30th 2021, 16:13 |
martin |
was hoping i was able to just create a virtual field inside entity where I can return $user->can(‘edit’, $this); :P |
# |
Apr 30th 2021, 16:08 |
martin |
I’ve policies to check if the user is allowed to edit the entity. but since it is a api response, and user will see all entities the frontent needs to know which one can be edited |
# |
Apr 30th 2021, 16:08 |
kevin.pfeifer |
which therefore needs access to the table object |
# |
Apr 30th 2021, 16:07 |
kevin.pfeifer |
because `canEdit` authorizations are usually handled via Policies |
# |
Apr 30th 2021, 16:07 |
martin |
yes |
# |
Apr 30th 2021, 16:07 |
kevin.pfeifer |
you mean inside the entity of which should be checked against the current logged in user? |
# |
Apr 30th 2021, 15:56 |
martin |
Can I access the authorization inside a entity? I need to have in api response if user can edit a entity. |
# |
Apr 30th 2021, 13:42 |
louis |
Does it indent well your template file ? Php is well formatted but the HTML is not |
# |
Apr 30th 2021, 13:23 |
louis |
Thanks @admad ! |
# |
Apr 30th 2021, 13:12 |
admad |
install https://github.com/cakephp/cakephp-codesniffer/ so can use can use the coding standard "CakePHP" for phpcs |
# |
Apr 30th 2021, 13:11 |
admad |
@louis don't use intelephense's code formatter. Install this plugin for phpcs https://github.com/wongjn/vscode-php-sniffer and use that for formatting. |
# |
Apr 30th 2021, 12:49 |
sebastiansperandio093 |
I just use it when vscode "make yours" |
# |
Apr 30th 2021, 12:49 |
sebastiansperandio093 |
but I dont use too |
# |
Apr 30th 2021, 12:48 |
sebastiansperandio093 |
mmm I have a plugin called beautify |
# |
Apr 30th 2021, 12:33 |
louis |
Hello there, First time i’m working on a CakePHP 4 app, layout extension is now .php. I struggle with indent, VScode with intelephense broke all indent :,( |
# |
Apr 30th 2021, 11:13 |
joacir.santos |
@revillosakristianpaol I think you should use Expression like this: ```$expression = new QueryExpression('quantity = quantity + 10'); $updated = $this->updateAll([$expression], ['id' => 4]);``` |
# |
Apr 30th 2021, 08:10 |
kevin.pfeifer |
even though it should in my opinion |
# |
Apr 30th 2021, 08:10 |
kevin.pfeifer |
i am trying that right now too but somehow this doesn’t work ```$this->Projects->updateAll(['Projects.netto' => 'Projects.netto + 1'], ['Projects.id' => 3]);``` |
# |
Apr 30th 2021, 07:50 |
revillosakristianpaol |
im using updateAll |
# |
Apr 30th 2021, 07:47 |
kevin.pfeifer |
are you using the patchEntity method or the updateAll method? |
# |
Apr 30th 2021, 07:28 |
revillosakristianpaol |
I have another question, how do i update record with records from previous data in sql it look like this "update table set quantity = quantity+10 where Id = 4; |