O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Default roles must be declared in the CAuthManager::defaultRoles property. For example,<br />
the following configuration declares two roles to be default roles: authenticated and guest.<br />
return array(<br />
'components'=>array(<br />
'authManager'=>array(<br />
'class'=>'CDbAuthManager',<br />
'defaultRoles'=>array('authenticated', 'guest'),<br />
),<br />
),<br />
);<br />
Because a default role is assigned to every user, it usually needs to be associated with a<br />
business rule that determines whether the role really applies to the user. For example, the<br />
following code defines two roles, authenticated and guest, which effectively apply to<br />
authenticated users and guest users, respectively.<br />
$bizRule='return !<strong>Yii</strong>::app()->user->isGuest;';<br />
$auth->createRole('authenticated', 'authenticated user', $bizRule);<br />
$bizRule='return <strong>Yii</strong>::app()->user->isGuest;';<br />
$auth->createRole('guest', 'guest user', $bizRule);<br />
Temas<br />
Theming is a systematic way of customizing the outlook of pages in a Web application. By<br />
applying a new theme, the overall appearance of a Web application can be changed<br />
instantly and dramatically.<br />
In <strong>Yii</strong>, each theme is represented as a directory consisting of view files, layout files, and<br />
relevant resource files such as images, CSS files, JavaScript files, etc. The name of a<br />
theme is its directory name. All themes reside under the same directory WebRoot/themes.<br />
At any time, only one theme can be active.<br />
Tip: The default theme root directory WebRoot/themes can be configured to be a<br />
different one. Simply configure the basePath and the baseUrl properties of the<br />
themeManager application component to be the desired ones.<br />
Using a Theme<br />
To activate a theme, set the theme property of the Web application to be the name of the<br />
desired theme. This can be <strong>do</strong>ne either in the application configuration or during runtime in<br />
controller actions.