"Fossies" - the Fresh Open Source Software Archive

Member "db/migrate/20161112000001_organization_domain_based_assignment.rb" (25 Mar 2021, 2203 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 "20161112000001_organization_domain_based_assignment.rb": 3.4.1_vs_3.5.0.

    1 class OrganizationDomainBasedAssignment < ActiveRecord::Migration[4.2]
    2   def up
    3     # return if it's a new setup
    4     return if !Setting.exists?(name: 'system_init_done')
    5 
    6     add_column :organizations, :domain, :string, limit: 250, null: true, default: ''
    7     add_column :organizations, :domain_assignment, :boolean, null: false, default: false
    8     add_index :organizations, [:domain]
    9 
   10     # rubocop:disable Lint/BooleanSymbol
   11     ObjectManager::Attribute.add(
   12       force:         true,
   13       object:        'Organization',
   14       name:          'domain_assignment',
   15       display:       'Domain based assignment',
   16       data_type:     'boolean',
   17       data_option:   {
   18         null:       true,
   19         default:    false,
   20         note:       'Assign Users based on users domain.',
   21         item_class: 'formGroup--halfSize',
   22         options:    {
   23           true:  'yes',
   24           false: 'no',
   25         },
   26         translate:  true,
   27       },
   28       editable:      false,
   29       active:        true,
   30       screens:       {
   31         edit: {
   32           Admin: {
   33             null: false,
   34           },
   35         },
   36         view: {
   37           '-all-' => {
   38             shown: true,
   39           },
   40         },
   41       },
   42       to_create:     false,
   43       to_migrate:    false,
   44       to_delete:     false,
   45       position:      1410,
   46       updated_by_id: 1,
   47       created_by_id: 1,
   48     )
   49     # rubocop:enable Lint/BooleanSymbol
   50 
   51     ObjectManager::Attribute.add(
   52       force:         true,
   53       object:        'Organization',
   54       name:          'domain',
   55       display:       'Domain',
   56       data_type:     'input',
   57       data_option:   {
   58         type:       'text',
   59         maxlength:  150,
   60         null:       true,
   61         item_class: 'formGroup--halfSize',
   62       },
   63       editable:      false,
   64       active:        true,
   65       screens:       {
   66         edit: {
   67           '-all-' => {
   68             null: true,
   69           },
   70         },
   71         view: {
   72           '-all-' => {
   73             shown: true,
   74           },
   75         },
   76       },
   77       to_create:     false,
   78       to_migrate:    false,
   79       to_delete:     false,
   80       position:      1420,
   81       updated_by_id: 1,
   82       created_by_id: 1,
   83     )
   84 
   85     Cache.clear
   86   end
   87 end