tailieunhanh - Agile Web Application Development with Yii 1.1 and PHP5 phần 6

Như chúng ta đã thiết lập tài sản pagination của nhà cung cấp dữ liệu của chúng tôi rất thấp (nhớ là chúng tôi thiết lập nó để chỉ cần 1), chúng ta có thể thêm một vấn đề nữa để chứng minh các chức năng phân trang được xây dựng trong. Thêm một thay đổi vấn đề màn hình hiển thị các vấn đề có liên kết cho phép chúng ta đi từ trang này sang | Chapter 7 states. These are the extra user values that should be persisted throughout a user s session. As an example of this we are setting the attribute named lastLoginTime to be the value of the last_login_time field in the database. This way at any place in the application this attribute can be accessed via Yii app - user- lastLoginTime As the initial user rows go into the table with null values for the last login time there is a quick check for null so that we can store an appropriate time when the user logs in for the very first time. We have also taken the time to format the date for better readability. The reason we take a different approach when storing the last login time versus the ID is that id just happens to be an explicitly defined property on the cuseridentity class. So other than name and id all other user attributes that need to be persisted throughout the session can be set in a similar manner. When cookie-based authentication is enabled by setting CWebUser allowAutoLogin to be true these user identity states will be stored in cookie. Therefore you should not store sensitive information for example password in the same manner as we have stored the user s last login time. With these changes in place you will now need to provide a correct username and password combination for a user defined in the tbl_user table in the database. Using demo demo or admin admin will of course no longer work. Give it a try. You should be able to log in as any one of the users you created earlier in this chapter. If you followed along and have the same user data as we do the following credentials should work Username Test_User_One Password testl Now that we have altered the login process to authenticate against the database we won t be able to access the delete functionality for any of our project issue or user entities. The reason for this is that there are authorization checks in place to ensure that the user is an admin prior to allowing access. Currently none of .

TỪ KHÓA LIÊN QUAN