# |
May 12th 2021, 08:07 |
naresh.thakur1987 |
on the another sub domain I don't have ssl and it works perfect. |
# |
May 12th 2021, 08:04 |
conehead |
And this does not happen if you do not use ssl? |
# |
May 12th 2021, 08:02 |
naresh.thakur1987 |
```Warning (2): exif_imagetype(http://inventory.dondoca.com/img/products/140-0-thumbnail.jpg): failed to open stream: Connection timed out [APP/Controller/Component/ImageComponent.php, line 16]``` |
# |
May 12th 2021, 08:01 |
conehead |
What is your issue? You should be able to use SSL without any changes |
# |
May 12th 2021, 07:56 |
naresh.thakur1987 |
Hello All, How to use SSL with CakePHP4. I am facing issue. Can somebody guid me to some document for this? |
# |
May 11th 2021, 21:52 |
ndm |
Might be helpful if _someone_ looks into it some day, having a helpful exception being thrown in case of such a conflicting contain config (assuming it's not a bug) might be nice to have... but yeah, it's probably not going to be me, my todo list is already veeeery long :upside_down_face: |
# |
May 11th 2021, 21:46 |
djinn.vsl |
haha yeah, I know... so I might be lucky not encountering this first. BTW, I made a type (not important) `Measures` is not associated with `Complaints` Since I already made the changes and you told me is a good idea to have different names, I'll leave it this way. If you wan't to dig into the ORM, to see if this can be an improvement it's nice but don't worry about me since you already helped :) |
# |
May 11th 2021, 21:40 |
ndm |
Also, the 3+ ORM is a totally different beast to whatever 2.x was doing, you can't compare their quirks, the 3+ ORM is to the 2.x ORM, what sulfur breathing, winged 10 feet Mars goblins are to the human race ;) |
# |
May 11th 2021, 21:29 |
ndm |
It's probably got to do with the nested users being handled by a separate eager loader instance. |
# |
May 11th 2021, 21:24 |
slackebot |
right now, I'd have to try to replicate your association setup first and dig through the ORM source. |
# |
May 11th 2021, 21:24 |
ndm |
Well, the associations are not the same, `Complaints` is `hasOne`, and `Measures` is `hasMany`, the latter type of association is being retrieved in a separate query, so that probably explains the difference in behavior, as the nested users related config and stuff wont clash with other identical association names for the same query. What exactly makes the `belongsToMany` users affect the `hasOne > belongsTo` users, I can't tell |
# |
May 11th 2021, 20:58 |
djinn.vsl |
Been working with Cake since 2.x and this never happened to me. (even doing worse practices than I might be doing now) |
# |
May 11th 2021, 20:56 |
slackebot |
```$this->Proceedings->get($id)->contain(['Users', 'Measures' => ['Users'], 'Complaints' => ['Users']]); //output Proceedings ->users[] <--- OK ->measures ->user <--- OK ->complaints -> <--- NO USER!!!``` ```$this->Proceedings->get($id)->contain(['Measures' => ['Users'], 'Complaints' => ['Users']]); //output Proceedings ->measures ->user <--- OK ->complaints ->user <--- OK``` |
# |
May 11th 2021, 20:56 |
slackebot |
belongsTo Proceedings (proceeding_id) belongsTo Users (user_id) Users belongsTo Proceedings (proceeding_id) ---- I also tried 'hasMany' with same result. hasMany Measures (user_id) hasMany Complaints (user_id)``` ```$this->Proceedings->get($id)->contain(['Users', 'Measures' => ['Users']]); //output Proceedings ->users <--- OK ->measures ->users <--- OK``` |
# |
May 11th 2021, 20:56 |
djinn.vsl |
That's what I thought and that's why I changed the association name... but *why in one case it works and not in the other* while the associations are the same: ```Proceedings belongsToMany Users (proceedings_users table) hasMany Measures (proceeding_id) hasOne Complaints (proceeding_id) Measures belongsTo Proceedings (proceeding_id) belongsTo Users (user_id) hasOne Complaints (measure_id) Complaints |
# |
May 11th 2021, 20:21 |
ndm |
You should generally be careful with association names, as tables are only instantiated once per alias, so you could easily create problems like for example cyclic references. Duplicate aliases can also cause problems with join based associations, as aliases must be unique on SQL level, so the ORM will only join them once IIRC. |
# |
May 11th 2021, 20:08 |
djinn.vsl |
Or maybe there's a proper way to get the details of `Proceedings->complaint->user` since I have the same user inside `Proceedings->users[]` but I prefer to let Cake do the job |
# |
May 11th 2021, 19:56 |
slackebot |
not error thrown by Cake and If I call `Complaints->Users` I can see the `Users` but not if, in the same query, I get `Proceedings->Users` Thank you! |
# |
May 11th 2021, 19:56 |
slackebot |
retrieve the following in the same query : ```Proceedings ->users ->measures ->users``` I reverted my changes and try to retrieve `Proceedings->find()->contain(['Users, 'Measures' => ['Users'], 'Complaints' => ['Users', 'Files']);`, I got no users inside `Complaints`: ``` Proceedings ->users ->measures ->users ->complaints ->files <----- no users inside complaints``` *Any idea why?* There is |
# |
May 11th 2021, 19:56 |
slackebot |
`Complaints`: ```Proceedings ->complaints ->users ->files``` Yesterday I thought It can't be done and renamed one of the associations from `Users` to `Complainants` and it worked: Now I was retrieving `Users` but named as `Complainants` ```Proceedings ->users ->complaints ->complainants ->files``` But, after changing all code in my project, today I found that it should work because I can |
# |
May 11th 2021, 19:56 |
djinn.vsl |
Hello. I'm trying to retrieve the same table in different associations in the same Query The table I'm trying to get is "Users". The problem is that if I do `Proceedings->find()->contain(['Users', 'Complaints' => ['Users', 'Files']);` I only get: ```Proceedings ->users ->complaints ->files <----- no users inside complaints``` If I remove `Proceedings->Users` from the contain, then I got `Users` inside |
# |
May 11th 2021, 15:39 |
paolo.bragagni |
probably you are right! |
# |
May 11th 2021, 15:38 |
ndm |
So, wouldn't it make sense then to only run your ID provider authentication mechanism on `POST` requests (when you have no token that you could refresh)? Assuming that the lack of such a check is responsible for your automatic re-login problem. |
# |
May 11th 2021, 15:38 |
paolo.bragagni |
(it doesnt work...) |
# |
May 11th 2021, 15:35 |
paolo.bragagni |
if I register from 'spid' it get username from idprovider |
# |
May 11th 2021, 15:35 |
paolo.bragagni |
when I go with register if I'm in 'smartcard' it takes username from smartcard |
# |
May 11th 2021, 15:34 |
paolo.bragagni |
I'd like that user can authenticate with User and passw, smartcard or IdProvider |
# |
May 11th 2021, 15:33 |
slackebot |
<paolo.bragagni> |
# |
May 11th 2021, 15:27 |
ndm |
Again, do you provide any login "form" in your users controller's login action, or does visiting that URL automatically send visitors to your ID provider? |
# |
May 11th 2021, 15:26 |
paolo.bragagni |
hum |
# |
May 11th 2021, 15:25 |
ndm |
Boy.. that wording... |
# |
May 11th 2021, 15:24 |
ndm |
All this basically does is invoke `clearIdentity()` being called on all authenticators that do implement `\Authentication\Authenticator\PersistenceInterface`, and dispatch an `Authentication.logout` event (it also returns a redirect URL btw). If your code doesn't use neither to do any authentication, then this shouldn't really be a problem. |
# |
May 11th 2021, 15:21 |
paolo.bragagni |
reauthenticate because my (terrible) autenticate is fired |
# |
May 11th 2021, 15:20 |
paolo.bragagni |
this line $this->Authentication->logout(); |
# |
May 11th 2021, 15:19 |
paolo.bragagni |
public function logout() { $this->Authorization->skipAuthorization(); $this->Authentication->logout(); return $this->redirect(['controller' => 'Users', 'action' => 'login']); } |
# |
May 11th 2021, 15:19 |
ndm |
As we all do, learning never stops :) |
# |
May 11th 2021, 15:19 |
paolo.bragagni |
the problem is that in my Users logout action |
# |
May 11th 2021, 15:17 |
paolo.bragagni |
thanks ndm trying o learn.. :S |
# |
May 11th 2021, 15:15 |
slackebot |
"login (with xyz provider)" button or the like? |
# |
May 11th 2021, 15:15 |
ndm |
First things first, never access superglobals with CakePHP directly, always use the request object for that, and never die in your code, use graceful returns or exceptions (for redirects in authenticators you can specifically use `\Authentication\Authenticator\AuthenticationRequiredException` with a `Location` header passed to it)! Besides that, this all happens automatically I guess, ie you're not showing logged out users a |
# |
May 11th 2021, 15:08 |
paolo.bragagni |
provider response with $_GET['code'] that I use for get the user via curl |