zfcuser add user role after registration

前端 未结 4 2092
没有蜡笔的小新
没有蜡笔的小新 2021-02-10 06:08

I\'m using Zend Framework 2 with ZfcUser, BjyAuthorize and Doctrine for the database. Registration etc. works very well so far. My problem is, that registered users have no role

4条回答
  •  忘掉有多难
    2021-02-10 06:47

    I just used a MySQL trigger

    DROP TRIGGER IF EXISTS `user_role_after_insert_trig`;
    DELIMITER //
    CREATE TRIGGER `user_role_after_insert_trig` AFTER INSERT ON `user`
     FOR EACH ROW begin
      insert into user_role_linker (user_id,role_id) values (new.user_id, 5);
    end
    //
    DELIMITER ;
    

提交回复
热议问题