adobe photoshop 60 download

Adobe Premiere Pro CS5 discount free adobe dream weaver 8 download free download adobe distiller cheapest adobe photoshop free download full version where does adobe save download video files

adobe bridge download

Adobe Creative Suite 4 for Mac buy cheap download adobe photoshop elements 5 adobe download free premiere pro buy cheap adobe acrobat 8 download purchase adobe photoshop cs3 extended full download

free adobe download manager

buy cheap Adobe cs5 Design Premium for Mac adobe acrobat reader 6 0 1 free download adobe flashplayer download softpedia discount download adobe after effects download adobe after effects

free download adobe illustrator 9

cheapest Adobe cs5 for Mac adobe cs2 download free crack key generator how to download adobe flash movies cheapest adobe acrobat reader free download adobe 8 free download

free adobe download

Autodesk AutoCAD cheapest adobe download free premiere adobe distiller free download discount download adobe flashplayer free adobe download manager download

adobe audition 1 5 download

cheap AutoCAD Architecture adobe acrobat 8 free download adobe creative suite 2 download cheapest download adobe premiere pro cs3 download adobe reader cd

adobe encore menu download

cheapest Adobe Captivate CS5.5 download adobe ebook reader adobe photoshop elements 3 for mac download cheap download adobe photoshop 7 download adobe flash player

download adobe reader latest version

discount Creative Suite 5.5 download adobe photoshop cs2 adobe photoshop 8 free download full version discount download free adobe standard adobe flas player 9 download

download adobe photoshop mac free

Autodesk AutoCAD discount free adobe 8 download free download of adobe pagemaker buy cheap adobe dream weaver 8 download download adobe scanner

adobe reader download for mac

discount AutoCAD 2010 free adobe download free download of adobe reader buy cheap free download adobe photodeluxe home edition adobe flash player 8 download

adobe lightroom download

AutoCAD LT 2012 buy cheap adobe golive cs2 download freeware adobe acrobat download cheap adobe flash activex download download adobe flashplayer

adobe flash 9 download

adobe acrobat x buy cheap adobe free download software download adobe photoshop cs2 cheap download adobe audition 3 free adobe premiere download

adobe flash offline download

adobe creative suite 5 discount download adobe acrobat reader 8 adobe 9 download discount free adobe photoshop elements 6 download download adobe reader pdf free

search adobe reader 7 0 download

cheap adobe cs5 adobe acrobat writer free download adobe fine reader free download cheap adobe player download center adobe professional download

download adobe flashplayer free

Adobe cs5 Design Premium cheapest where free download adobe acrobat free download of adobe reader buy cheap adobe flash 7 download download adobe reader8

free adobe acrobat writer download

Adobe eLearning Suite cheap download adobe active x download adobe acrobat 7 updates discount download adobe flash 9 for h264 free adobe pdf maker download

adobe photo plus 6 download

discount Adobe eLearning Suite 2 download adobe photoshop cs2 adobe illustrator full crack download cheapest adobe photoshop download site adobe acrobat raeder v7 download

adobe flash player download for windows vista

discount Adobe Flash Catalyst CS5 adobe photo editor download adobe reader 6 free download discount download adobe flashplayer free free download adobe illustrator 9

adobe shockwave player download

discount Adobe Indesign CS5 free adobe dream weaver 8 download adobe photo free download cheapest adobe flash player downloader free download hunter grabber free adobe profesional 8 download

adobe type manager download free

discount Adobe Photoshop CS5 download adobe acrobat reader free old adobe software download discount download adobe flash player stand alone adobe acrobat update download

Set Credentials using security.yml in Symfony 1.4

Symfony provides some cool configuration features that would allow you to minimize your coding part .  In this tutorial i would explain how to configure security.yml to set credentials for a different users.

Create a class file named account.class.php under apps/frontend/lib folder with content .The class below checks weather the user is admin and sets his credential as ‘admin’ . Update the class file as your requirement .


class account
{
 public static function getLoginAdmin($username, $password)
 {
 // code to check for username and password in a particular table : ORM is doctrine
 $usr = Doctrine::getTable('TableName')
 ->createQuery('a')
 ->where('a.adminuser = ?',$username)
 ->andWhere('a.password = ?',$password)
 ->execute();

 $login_user = count($usr);

 if($login_user > 0)
 {
 sfContext::getInstance()->getUser()->setAuthenticated(true);
 sfContext::getInstance()->getUser()->addCredential('admin');

 return true;
 }
 else
 {
 return false;
 }
 }
 public static function LogoutSession()
 {
 sfContext::getInstance()->getUser()->setAuthenticated(false);
 sfContext::getInstance()->getUser()->clearCredentials();

 sfContext::getInstance()->getUser()->getAttributeHolder()->removeNamespace('admin');

 return true;
 }
}

And in login action file after receiving username and password call the library function as shown below


$login_flag = account::getLoginAdmin($this->username,$this->password);

and if $login_flag returns true you have successfully logged in else enter username or password is invalid .

You have done with the class file and action page . Now you need to configure security.yml .

Create a folder named config inside a module ( say for eg : under admin module ) with security.yml in it and paste the following code .


index:
is_secure: true
credentials: admin

Now admin module can be accessed only by one with ‘admin’ credential .

You can flush the credential as


$logout = account::LogoutSession();

You are done !

About the Author: a holistic web developer , movie buff and technical blogger from queen of arabian sea.

RSSComments (3)

Leave a Reply | Trackback URL

  1. Andrés says:

    Hi, is very easy the example i understand all code but the implementation in my app-symfony not give me good results. (sorry for my bad english). I follow line to line the code but i have problem with the credentials. I setup all configuration files of my app and not find the solution. When redirect to another module (module “sala”) gives me a message saying “Credential Required. This page is in a restricted area.” and it is very strange because when the user login credentials I setup to “admin” and the module “sala” I allow users to enter credentials “admin” and although I’ve tried changing some things it still does not work. I hope help me.

    Thanks.

  2. anoopsachari says:

    i think the error is due to the security.yml file . where did you create it ?

  3. Andre says:

    This security.yml configuration reference could be useful: http://www.symfonyreference.com/security-yml

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes