| [resolved] Using .htaccess password with myUser class [message #5738] |
Thu, 04 May 2006 17:26  |
sprouse Messages: 19 Registered: April 2006 |
Junior Member |
|
|
|
How would I go about setting up the myUser class so that it grabs the username from $_SERVER['PHP_AUTH_USER'] and then renders each page for the user?
[Updated on: Fri, 14 July 2006 00:20] by Moderator
|
|
|
|
|
|
|
|
|
| Re: Using .htaccess password with myUser class [message #8774 is a reply to message #5738 ] |
Thu, 13 July 2006 15:28   |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
sprouse, I presume you are having trouble in relation to your second question rather than your first. Have you used a tool (like Firefox's Tamper Data plugin) to see whether you are getting the headers you have set up?
You may get more answers if you post your security.yml here, plus the path it appears under, and any other code snippets you consider relevant.
Remember Palestine
|
|
|
| Re: Using .htaccess password with myUser class [message #8775 is a reply to message #8774 ] |
Thu, 13 July 2006 16:01   |
zsolesz Messages: 126 Registered: July 2006 Location: Budapest, Hungary |
Senior Member |
|
|
Thanks for your answers, I solved the problem about 2 hours ago, and got here now to explain the solution:
first, my security.yml file:
all:
is_secure: on
credentials: moderator
add:
is_secure: on
credentials: moderator
all:
is_secure: on
credentials: administrator
add:
is_secure: on
credentials: administrator
all:
is_secure: off
And i modified a .php file, now i'm a bit confused wich one (on 21st day symfony-s directory tree and file system is a bit complicated for me, but i hope that this problem will collapse:)
So i modified this file used the repository, the remaining code snippet made credentials to the users when logging in, used the is_administrator and is_moderator fields in the database.
Hope that helps for asketters with the same problem.
_EDITED_:
ok now it disturbed me so i searched for this file, i found it in frontend/lib/myUser.class.php, and the code to be added is this:
if ($sf_user->getIsModerator())
{
$this->addCredential('moderator');
}
if ($sf_user->getIsAdministrator())
{
$this->addCredential('administrator');
}
sorry if my problem was 120
[Updated on: Thu, 13 July 2006 16:06]
|
|
|
| Re: Using .htaccess password with myUser class [message #8776 is a reply to message #5738 ] |
Thu, 13 July 2006 16:24  |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
In terms of your roles, you might find it more extensible to do something like this:
<?php $roles = $sf_user->getRoles();
$this->clearCredentials()
foreach ($roles as $role)
{
$this->addCredential($role->getName());
} ?>
It'd require a Role class, but it might help lessen maintenance if you add more role types. Just a thought
Remember Palestine
|
|
|