php - symfony 1.4 passing variables between templates and actions -


Symphony 1.4 variables going through templates and functions

I have an index page in which a call Includes a series of partial series through a switch statement; And it works now I need to restrict access to partial dependent on user type; Besides, I believe my switch statement should be in the verb class according to MVC, but I can not even get it to work, for example it can be better explained:

Here is my file structure for the dashboard module:

  .. Dashboard .. responses .. Configure .. templates _admins.php _employers.php _employees.php _guest.php indexSuccess.php   

Here's my current index success temp (Which currently works ... but if the type of user does not match the page type without entering the entry):

  $ type = sfContext :: getInstance () - & Gt; GetUser () - & gt; GetGuardUser () - & gt; GetProfile () - & gt; GetType () - & gt; GetName (); Switch ($ type) {case ('employer'): included_partial ('dashboard / employer'); $ Page_user_type = "employer"; // This example line does not currently exist, it is for example the purpose of under $ brake; Cases ('employees'): included_partial ('dashboard / staff'); break; Cases ('Administrators'): included- sectional ('dashboard / admin'); break; Default: include_partial ('dashboard / guest'); break; }   

Here is my verb square (currently empty):

  Execute public functions (sfWebRequest $ request) {}  < / Pre> 

Actually, what I need is the switch Statement (I think) has been taken into action, and added a further 404 unlace () method which does the following:

  $ Logged_user = sfContext :: getInstance) - & gt; GetUser () - & gt; GetGuardUser () - & gt; GetId (); $ This- & gt; Forwarded 404 Unlace ($ logged_user == $ page_user_type); // where $ page_user_type variable has been recovered by the switch statement in the example row given above   

I have not tried using getAttribute () and setAttribute () ... and I did not want to share efforts due to embarrassment. Just a start here ...

Any help would be appreciated. Thanks in advance.

Update:

Here's more information about the switch and various partialities:

The switch provides a different partial form depending on the type of user is. It does not do this by accessing all other partialities to other types of other log-in users ... which is very bad in my design, for example: "Employer" types of logged-in users are part of "employee" type Can not see by present, they can currently (by explicitly typing in other URLs), even if they are being redirected to the appropriate page during the index action.

The 404 page should be called when the wrong type user tries to use explicitly by typing in other partial URLs. This is the reason why I was trying to add a variable in the switch statement when it was called a partial partial and then that variable was going through an index action which would then evaluate it and would allow partially, or if User_type and partial_type did not match - & gt; Next thing on a 404 page right? I hope that I explained that thouroughly enough I'm sure there is an easy way ... I'm not just enough to learn this that what it can be.

I am sure that you appreciate your feedback and try to solve my problem.

You must play with the credential system to block an authorized user to access a resource. The 'type' of your user can become the name of a credential, after which you have to make security only to protect.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -