Hi, and thanks for Yii .
I need some advice to start a new system with 401 error.
I work on a very old system moved to Yii some year ago, then lot of code to be updated.
Actually we have 2 restriction:
-
User access : some part of user access is limited by url parameters (post or get, never mind) : this part used a HTML hard produced with ‘You don’t have access’ (managed by 9 controllers actually)
-
Admin part access : this part must be allowed only to admin connected user (with specific rigths) (managed by 2 controllers actually (and a lot of subcontroller))
Then, we have for example:
[list=1]
[*]‘user/?id=123’ : you don’t have access to this part : 401 without form BUT some part of views can be change uppon id
[*]‘admin/?id=123&action=dothis’ : 2 solution
[list=2]
[*]Loggued but no access: 401 without form
[*]Not loggued: 401 with a form
[/list]
[/list]
Actually, i think moving to
throw new CHttpException(401,"401 Unauthorized");
Really more clean, but then i need different system:
-
User part : 401 with some parameters in view
-
Admin part : 401 with some parameters in view and an optionnal login form
I see how to put a optional login form , but i don’t have an idea to
-
send the information of the original controller
-
Use specific parameters in User view ( different id can change : the language, the css etc …)
Maybe someone have a betterv idea than me
Denis