"Fossies" - the Fresh Open Source Software Archive

Member "db/migrate/20170608151442_enhanced_permissions.rb" (25 Mar 2021, 853 Bytes) of package /linux/www/zammad-4.0.0.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "20170608151442_enhanced_permissions.rb": 3.4.1_vs_3.5.0.

    1 class EnhancedPermissions < ActiveRecord::Migration[4.2]
    2   def up
    3 
    4     # return if it's a new setup
    5     return if !Setting.exists?(name: 'system_init_done')
    6 
    7     change_column_null :groups_users, :user_id, false
    8     change_column_null :groups_users, :group_id, false
    9     add_column :groups_users, :access, :string, limit: 50, null: false, default: 'full'
   10     add_index :groups_users, [:access]
   11     UserGroup.connection.schema_cache.clear!
   12     UserGroup.reset_column_information
   13 
   14     create_table :roles_groups, id: false do |t|
   15       t.references :role,                null: false
   16       t.references :group,               null: false
   17       t.string :access, limit: 50, null: false, default: 'full'
   18     end
   19     add_index :roles_groups, [:role_id]
   20     add_index :roles_groups, [:group_id]
   21     add_index :roles_groups, [:access]
   22 
   23     Cache.clear
   24   end
   25 end