0

我安装了 sfGuard 插件,并设置了三个用户组和权限。这是在最初安装插件的时候做的,数据库里没有很多数据。我想添加一个具有新权限的新用户组。

我已经编辑了 fixtures 目录中的 sfGuard.yml 文件。如何在不清除当前数据的情况下将新的 yml 数据上传到 SQL 数据库?

这是 sfGuard.yml 片段:

sfGuardGroup:
  Group_univ_admin:
    name:           univ_admins
    description:    Universal Administrators
    Permissions:    [Permission_admin, Permission_universal]
  Group_univ_editor:
    name:           univ_editors
    description:    Universal Editors
    Permissions:    [Permission_editor, Permission_universal]
  Group_dept_admin:
    name:           dept_admins
    description:    Department Administrators
    Permissions:    [Permission_admin, Permission_department]
  Group_dept_editor:
    name:           dept_editors
    description:    Department Editors
    Permissions:    [Permission_editor, Permission_department]
  Group_dept_faculty:
    name:           dept_faculties
    description:    Department Faculties
    Permissions:    [Permission_faculty, Permission_department]

sfGuardPermission:
  Permission_admin:
    name:           administrator
    description:    Administrator permission
  Permission_editor:
    name:           editor
    description:    Editor permission
  Permission_universal:
    name:           universal
    description:    Universal permission
  Permission_department:
    name:           department
    description:    Department permission
  Permission_faculty:
    name:           faculty
    description:    Faculty permission

任何方向都会很棒!

4

1 回答 1

3

我相信加载数据的标准夹具任务不会覆盖任何现有数据,只要您不重新构建数据库和模型:

php symfony doctrine:data-load data/fixtures/some_specific_file.yml

I would recommend calling the fixtures filename explicitly (as above) to avoid accidentally including a fixtures file from elsewhere in the project structure. There are several places from which they can be included, such as the sfDoctrineGuardPlugin. Do of course also run this on a dev/local database before production to avoid screw-ups.

于 2012-06-07T19:39:24.300 回答