Closed wonpingonly closed 2 years ago
Thanks for your question!
From the README:
During the lifetime of a session, some user data may be changed remotely, either by a client in another session or by an administrator. That means this information must be regularly resynchronized with its authoritative source in the database, which this library does automatically. By default, this happens every five minutes. If you want to change this interval, pass a custom interval in seconds to the constructor as the fifth argument, which is named
$sessionResyncInterval
.
Does that help?
If you are fine with one extra database query per access, you can set this to zero and have instant updates for all these values.
(It should have been the same for the roles (as opposed to the status), but maybe that worked just coincidentally.)
Hey, I just learned something new. Thanks!
@ocram Yes! That addresses the issue. What was happening was that I ended up resetting the database after running each test so I never ended up having the status changed long enough for the UI to catch up. Thanks for the explanation. In retrospect I do recall reading about the latency my first time through the ReadMe but it didn't click for me that was the issue here. I was also fooled by the fact that the test page supplied in the GitHub repository allowed me to view a user's roles immediately after changing the value in the db so I assumed that status would work the same way.
While we are on the subject, I ran across this issue https://github.com/delight-im/PHP-Auth/issues/94 while trying to figure out how to work with user status. The functionality to change status via API is conspicuously absent considering how well fleshed out the rest of PHP-Auth is. I am sure you have plenty on your plate but just in case this fell off the to-do list, I'd like to bump this topic.
Thanks for creating and maintaining such a useful and well made authentication package.
Thanks, glad it worked!
As for https://github.com/delight-im/PHP-Auth/issues/94 , you are right, this is still missing for no good reason. It should be addressed soon.
Based on the https://github.com/delight-im/PHP-Auth/blob/master/src/Status.php and the column being an integer, I assume that the values 0 through 5 correspond to the different status values. But when I go into the database and change the value from 0 to another number,
$auth->isNormal()
still is true. When I dump the contents of the database directly to page, I can see that the "status" column correctly indicates the value (["status"]=>int(2)
). I didn't find sample code for how to set the value via the API so I am using phpLiteAdmin to manually set the value.Does status update somehow require using the API? Using this column would be really handy for my application but I don't understand why changing the value does not have the intended effect of changing the status. Any help is appreciated.
Edit: I should add that I can manually edit the roles_mask column and that behaves as expected.