F
F
fredrsf2014-11-04 00:00:03
Yii
fredrsf, 2014-11-04 00:00:03

How to properly check access in yii-rights?

The code:

var_dump(Yii::app()->user->checkAccess('Authenticated'));

always returns false, both for the guest and for the authorized user. Why is this happening?
Yii::app()->user->isGuest
for guest true for authorized false

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Wolf, 2014-11-04
@mannaro

maybe 'Authenticated' is not assigned to anyone?

F
fredrsf, 2014-11-04
@fredrsf

There is an entry in the AuthAssignment table
where 11 is just the user id.
There is an entry in the AuthItem table
Dump user shows

RWebUser Object
(
    [allowAutoLogin] => 1
    [guestName] => Guest
    [loginUrl] => Array
        (
            [0] => /user/login
        )

    [identityCookie] => 
    [authTimeout] => 
    [absoluteAuthTimeout] => 
    [autoRenewCookie] => 
    [autoUpdateFlash] => 1
    [loginRequiredAjaxResponse] => 
    [_keyPrefix:CWebUser:private] => 57e2c94f32f56d824ec3d429c04b1a90
    [_access:CWebUser:private] => Array
        (
        )

    [behaviors] => Array
        (
        )

    [_initialized:CApplicationComponent:private] => 1
    [_e:CComponent:private] => 
    [_m:CComponent:private] => 
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question