开发者

How to add acl per row?

I have problem with ACL. I read tutorial from here and here, and now I know how to add permission to some user/group to edit his profile, but then all users can edit each other profile. How I can set permiss开发者_如何学运维ion so user can edit just his own profile, not others, or can I somehow put this code in edit function:

function edit($id = null) {
    if ($logedUserId != $id) {
        // deny access
        return;
    }

    // edit user
}


Assuming that you are using action-based access control (which it appears as though you are), then unless you have an action named after each profile (which would be completely wrong) you will have to do an additional check within the edit() method to ensure that the profile being edited belongs to the currently logged in user.

So you sort of answered your own question--correctly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜