This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » General discussion » [resolved] Using .htaccess password with myUser class
[resolved] Using .htaccess password with myUser class [message #5738] Thu, 04 May 2006 17:26 Go to next message
sprouse  is currently offline 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 #5792 is a reply to message #5738 ] Fri, 05 May 2006 16:50 Go to previous messageGo to next message
sprouse  is currently offline sprouse
Messages: 19
Registered: April 2006
Junior Member
bump
Re: Using .htaccess password with myUser class [message #5890 is a reply to message #5738 ] Mon, 08 May 2006 19:46 Go to previous messageGo to next message
sprouse  is currently offline sprouse
Messages: 19
Registered: April 2006
Junior Member
anyone? anyone?
Re: Using .htaccess password with myUser class [message #6060 is a reply to message #5738 ] Thu, 11 May 2006 17:13 Go to previous messageGo to next message
sprouse  is currently offline sprouse
Messages: 19
Registered: April 2006
Junior Member
For those of you who have the same issue I found this in the wiki:

http://www.symfony-project.com/trac/wiki/HowtoAddHTTPAuthSup port

It looks useful. I'll let you know how it works out.
Re: Using .htaccess password with myUser class [message #6075 is a reply to message #6060 ] Thu, 11 May 2006 20:02 Go to previous messageGo to next message
sprouse  is currently offline sprouse
Messages: 19
Registered: April 2006
Junior Member
I set up the code from the link above and changed around the .yml config files to enable security. I cannot seem to get this to work. I just get "You must enter you credential to access this page." Anyone have a suggestion.

A response would be appreciated. Thanks
Re: Using .htaccess password with myUser class [message #8766 is a reply to message #6075 ] Thu, 13 July 2006 12:51 Go to previous messageGo to next message
zsolesz  is currently offline zsolesz
Messages: 126
Registered: July 2006
Location: Budapest, Hungary
Senior Member
Any solutions?

I get an error something like this:

"You cannot access this page."

i used security.yml with this:

default:
is_secure: off

and this too:

all:
is_secure: on
credentials: moderator

add:
is_secure: on
credentials: moderator

all:
is_secure: off

I get the error page when i open the "reported questions" link at the sidebar.

Does anybody know where the hasCredential() function takes place?

I just cant find it... Embarassed Embarassed

[Updated on: Thu, 13 July 2006 13:09]

Re: Using .htaccess password with myUser class [message #8773 is a reply to message #5738 ] Thu, 13 July 2006 15:27 Go to previous messageGo to next message
Draven  is currently offline Draven
Messages: 760
Registered: January 2006
Faithful Member
Are you giving the user the needed credential when you log in?

I'm pretty sure that

 is_secure: on
credentials: moderator


should be

 is_secure: on
credentials: [moderator]
Re: Using .htaccess password with myUser class [message #8774 is a reply to message #5738 ] Thu, 13 July 2006 15:28 Go to previous messageGo to next message
halfer  is currently offline 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 Go to previous messageGo to next message
zsolesz  is currently offline 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 Embarassed

[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 Go to previous message
halfer  is currently offline 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 Wink


Remember Palestine
Previous Topic:Symfony Security issue - XSS attack on form helpers
Next Topic:[resolved] input multi line!
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software