TAILIEUCHUNG - Agile Web Application Development with Yii 1.1 and PHP5 phần 7

Nếu các nỗ lực đã thành công, cần tiếp tục liên kết người sử dụng cho một dự án sử dụng phương pháp mới, associateUserToProject (người dùng), trước đây cũng như liên kết người sử dụng vai trò trong cách tiếp cận RBAC thảo luận trước đó trong chương này. | Chapter 8 If the attempt was successful it should continue to associate the user to a project using the new method associateUserToProject user added previously as well as associate the user to the role in the RBAC approach discussed earlier in this chapter. If no user was found matching the username it needs to set and return an error. If needed review the LoginForm authenticate method as an example of a custom validation rule method. Add a new view file under views project called to display our new form for adding users to projects. This form only needs two input fields username and role which is a dropdown choice listing. Add a new controller action method called actionAdduser to the ProjectController class and alter its accessRules method to ensure it is accessible by authenticated members. This new action method is responsible for rendering the new view to display the form and handling the post back when the form is submitted. Again we encourage the reader to attempt these changes on their own first. We list our code changes in the following sections. Altering the Project model class To the Project class we added three new public methods one of them static so it can be called without the need for a specific instance Returns an array of available roles in which a user can be placed when being added to a project public static function getUserRoleOptions return CHtml listData Yii app - authManager- getRoles name name Makes an association between a user and a the project public function associateUserToProject user sql INSERT INTO tbl_project_user_assignment project_id user_id VALUES projectId userId command Yii app - db- createCommand sql 203 Iteration 5 User Access Control command- bindValue projectId this- id PDO PARAM_INT command- bindValue userId user- id PDO PARAM_INT return command- execute Determines whether or not a user is already part of a project public function isUserInProject user sql SELECT user_id FROM tbl_project_user_assignment WHERE .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.