"Fossies" - the Fresh Open Source Software Archive

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

    1 class ObjectManagerUpdateUser < 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     UserInfo.current_user_id = 1
    8     ObjectManager::Attribute.add(
    9       force:       true,
   10       object:      'User',
   11       name:        'login',
   12       display:     'Login',
   13       data_type:   'input',
   14       data_option: {
   15         type:           'text',
   16         maxlength:      100,
   17         null:           true,
   18         autocapitalize: false,
   19         item_class:     'formGroup--halfSize',
   20       },
   21       editable:    false,
   22       active:      true,
   23       screens:     {
   24         signup:          {},
   25         invite_agent:    {},
   26         invite_customer: {},
   27         edit:            {},
   28         view:            {
   29           '-all-' => {
   30             shown: false,
   31           },
   32         },
   33       },
   34       to_create:   false,
   35       to_migrate:  false,
   36       to_delete:   false,
   37       position:    100,
   38     )
   39 
   40     ObjectManager::Attribute.add(
   41       force:       true,
   42       object:      'User',
   43       name:        'firstname',
   44       display:     'Firstname',
   45       data_type:   'input',
   46       data_option: {
   47         type:       'text',
   48         maxlength:  150,
   49         null:       false,
   50         item_class: 'formGroup--halfSize',
   51       },
   52       editable:    false,
   53       active:      true,
   54       screens:     {
   55         signup:          {
   56           '-all-' => {
   57             null: false,
   58           },
   59         },
   60         invite_agent:    {
   61           '-all-' => {
   62             null: false,
   63           },
   64         },
   65         invite_customer: {
   66           '-all-' => {
   67             null: false,
   68           },
   69         },
   70         edit:            {
   71           '-all-' => {
   72             null: false,
   73           },
   74         },
   75         view:            {
   76           '-all-' => {
   77             shown: true,
   78           },
   79         },
   80       },
   81       to_create:   false,
   82       to_migrate:  false,
   83       to_delete:   false,
   84       position:    200,
   85     )
   86 
   87     ObjectManager::Attribute.add(
   88       force:       true,
   89       object:      'User',
   90       name:        'lastname',
   91       display:     'Lastname',
   92       data_type:   'input',
   93       data_option: {
   94         type:       'text',
   95         maxlength:  150,
   96         null:       false,
   97         item_class: 'formGroup--halfSize',
   98       },
   99       editable:    false,
  100       active:      true,
  101       screens:     {
  102         signup:          {
  103           '-all-' => {
  104             null: false,
  105           },
  106         },
  107         invite_agent:    {
  108           '-all-' => {
  109             null: false,
  110           },
  111         },
  112         invite_customer: {
  113           '-all-' => {
  114             null: false,
  115           },
  116         },
  117         edit:            {
  118           '-all-' => {
  119             null: false,
  120           },
  121         },
  122         view:            {
  123           '-all-' => {
  124             shown: true,
  125           },
  126         },
  127       },
  128       to_create:   false,
  129       to_migrate:  false,
  130       to_delete:   false,
  131       position:    300,
  132     )
  133 
  134     ObjectManager::Attribute.add(
  135       force:       true,
  136       object:      'User',
  137       name:        'email',
  138       display:     'Email',
  139       data_type:   'input',
  140       data_option: {
  141         type:       'email',
  142         maxlength:  150,
  143         null:       false,
  144         item_class: 'formGroup--halfSize',
  145       },
  146       editable:    false,
  147       active:      true,
  148       screens:     {
  149         signup:          {
  150           '-all-' => {
  151             null: false,
  152           },
  153         },
  154         invite_agent:    {
  155           '-all-' => {
  156             null: false,
  157           },
  158         },
  159         invite_customer: {
  160           '-all-' => {
  161             null: false,
  162           },
  163         },
  164         edit:            {
  165           '-all-' => {
  166             null: false,
  167           },
  168         },
  169         view:            {
  170           '-all-' => {
  171             shown: true,
  172           },
  173         },
  174       },
  175       to_create:   false,
  176       to_migrate:  false,
  177       to_delete:   false,
  178       position:    400,
  179     )
  180 
  181     ObjectManager::Attribute.add(
  182       force:       true,
  183       object:      'User',
  184       name:        'web',
  185       display:     'Web',
  186       data_type:   'input',
  187       data_option: {
  188         type:       'url',
  189         maxlength:  250,
  190         null:       true,
  191         item_class: 'formGroup--halfSize',
  192       },
  193       editable:    false,
  194       active:      true,
  195       screens:     {
  196         signup:          {},
  197         invite_agent:    {},
  198         invite_customer: {},
  199         edit:            {
  200           '-all-' => {
  201             null: true,
  202           },
  203         },
  204         view:            {
  205           '-all-' => {
  206             shown: true,
  207           },
  208         },
  209       },
  210       to_create:   false,
  211       to_migrate:  false,
  212       to_delete:   false,
  213       position:    500,
  214     )
  215 
  216     ObjectManager::Attribute.add(
  217       force:       true,
  218       object:      'User',
  219       name:        'phone',
  220       display:     'Phone',
  221       data_type:   'input',
  222       data_option: {
  223         type:       'tel',
  224         maxlength:  100,
  225         null:       true,
  226         item_class: 'formGroup--halfSize',
  227       },
  228       editable:    false,
  229       active:      true,
  230       screens:     {
  231         signup:          {},
  232         invite_agent:    {},
  233         invite_customer: {},
  234         edit:            {
  235           '-all-' => {
  236             null: true,
  237           },
  238         },
  239         view:            {
  240           '-all-' => {
  241             shown: true,
  242           },
  243         },
  244       },
  245       to_create:   false,
  246       to_migrate:  false,
  247       to_delete:   false,
  248       position:    600,
  249     )
  250 
  251     ObjectManager::Attribute.add(
  252       force:       true,
  253       object:      'User',
  254       name:        'mobile',
  255       display:     'Mobile',
  256       data_type:   'input',
  257       data_option: {
  258         type:       'tel',
  259         maxlength:  100,
  260         null:       true,
  261         item_class: 'formGroup--halfSize',
  262       },
  263       editable:    false,
  264       active:      true,
  265       screens:     {
  266         signup:          {},
  267         invite_agent:    {},
  268         invite_customer: {},
  269         edit:            {
  270           '-all-' => {
  271             null: true,
  272           },
  273         },
  274         view:            {
  275           '-all-' => {
  276             shown: true,
  277           },
  278         },
  279       },
  280       to_create:   false,
  281       to_migrate:  false,
  282       to_delete:   false,
  283       position:    700,
  284     )
  285 
  286     ObjectManager::Attribute.add(
  287       force:       true,
  288       object:      'User',
  289       name:        'fax',
  290       display:     'Fax',
  291       data_type:   'input',
  292       data_option: {
  293         type:       'tel',
  294         maxlength:  100,
  295         null:       true,
  296         item_class: 'formGroup--halfSize',
  297       },
  298       editable:    false,
  299       active:      true,
  300       screens:     {
  301         signup:          {},
  302         invite_agent:    {},
  303         invite_customer: {},
  304         edit:            {
  305           '-all-' => {
  306             null: true,
  307           },
  308         },
  309         view:            {
  310           '-all-' => {
  311             shown: true,
  312           },
  313         },
  314       },
  315       to_create:   false,
  316       to_migrate:  false,
  317       to_delete:   false,
  318       position:    800,
  319     )
  320 
  321     ObjectManager::Attribute.add(
  322       force:       true,
  323       object:      'User',
  324       name:        'organization_id',
  325       display:     'Organization',
  326       data_type:   'autocompletion_ajax',
  327       data_option: {
  328         multiple:   false,
  329         nulloption: true,
  330         null:       true,
  331         relation:   'Organization',
  332         item_class: 'formGroup--halfSize',
  333       },
  334       editable:    false,
  335       active:      true,
  336       screens:     {
  337         signup:          {},
  338         invite_agent:    {},
  339         invite_customer: {
  340           '-all-' => {
  341             null: true,
  342           },
  343         },
  344         edit:            {
  345           '-all-' => {
  346             null: true,
  347           },
  348         },
  349         view:            {
  350           '-all-' => {
  351             shown: true,
  352           },
  353         },
  354       },
  355       to_create:   false,
  356       to_migrate:  false,
  357       to_delete:   false,
  358       position:    900,
  359     )
  360 
  361     ObjectManager::Attribute.add(
  362       force:       true,
  363       object:      'User',
  364       name:        'department',
  365       display:     'Department',
  366       data_type:   'input',
  367       data_option: {
  368         type:       'text',
  369         maxlength:  200,
  370         null:       true,
  371         item_class: 'formGroup--halfSize',
  372       },
  373       editable:    false,
  374       active:      true,
  375       screens:     {
  376         signup:          {},
  377         invite_agent:    {},
  378         invite_customer: {},
  379         edit:            {
  380           '-all-' => {
  381             null: true,
  382           },
  383         },
  384         view:            {
  385           '-all-' => {
  386             shown: true,
  387           },
  388         },
  389       },
  390       to_create:   false,
  391       to_migrate:  false,
  392       to_delete:   false,
  393       position:    1000,
  394     )
  395 
  396     ObjectManager::Attribute.add(
  397       force:       true,
  398       object:      'User',
  399       name:        'street',
  400       display:     'Street',
  401       data_type:   'input',
  402       data_option: {
  403         type:      'text',
  404         maxlength: 100,
  405         null:      true,
  406       },
  407       editable:    false,
  408       active:      true,
  409       screens:     {
  410         signup:          {},
  411         invite_agent:    {},
  412         invite_customer: {},
  413         edit:            {
  414           '-all-' => {
  415             null: true,
  416           },
  417         },
  418         view:            {
  419           '-all-' => {
  420             shown: true,
  421           },
  422         },
  423       },
  424       to_create:   false,
  425       to_migrate:  false,
  426       to_delete:   false,
  427       position:    1100,
  428     )
  429 
  430     ObjectManager::Attribute.add(
  431       force:       true,
  432       object:      'User',
  433       name:        'zip',
  434       display:     'Zip',
  435       data_type:   'input',
  436       data_option: {
  437         type:       'text',
  438         maxlength:  100,
  439         null:       true,
  440         item_class: 'formGroup--halfSize',
  441       },
  442       editable:    false,
  443       active:      true,
  444       screens:     {
  445         signup:          {},
  446         invite_agent:    {},
  447         invite_customer: {},
  448         edit:            {
  449           '-all-' => {
  450             null: true,
  451           },
  452         },
  453         view:            {
  454           '-all-' => {
  455             shown: true,
  456           },
  457         },
  458       },
  459       to_create:   false,
  460       to_migrate:  false,
  461       to_delete:   false,
  462       position:    1200,
  463     )
  464 
  465     ObjectManager::Attribute.add(
  466       force:       true,
  467       object:      'User',
  468       name:        'city',
  469       display:     'City',
  470       data_type:   'input',
  471       data_option: {
  472         type:       'text',
  473         maxlength:  100,
  474         null:       true,
  475         item_class: 'formGroup--halfSize',
  476       },
  477       editable:    false,
  478       active:      true,
  479       screens:     {
  480         signup:          {},
  481         invite_agent:    {},
  482         invite_customer: {},
  483         edit:            {
  484           '-all-' => {
  485             null: true,
  486           },
  487         },
  488         view:            {
  489           '-all-' => {
  490             shown: true,
  491           },
  492         },
  493       },
  494       to_create:   false,
  495       to_migrate:  false,
  496       to_delete:   false,
  497       position:    1300,
  498     )
  499 
  500     ObjectManager::Attribute.add(
  501       force:       true,
  502       object:      'User',
  503       name:        'address',
  504       display:     'Address',
  505       data_type:   'textarea',
  506       data_option: {
  507         type:       'text',
  508         maxlength:  500,
  509         null:       true,
  510         item_class: 'formGroup--halfSize',
  511       },
  512       editable:    false,
  513       active:      true,
  514       screens:     {
  515         signup:          {},
  516         invite_agent:    {},
  517         invite_customer: {},
  518         edit:            {
  519           '-all-' => {
  520             null: true,
  521           },
  522         },
  523         view:            {
  524           '-all-' => {
  525             shown: true,
  526           },
  527         },
  528       },
  529       to_create:   false,
  530       to_migrate:  false,
  531       to_delete:   false,
  532       position:    1350,
  533     )
  534 
  535     ObjectManager::Attribute.add(
  536       force:       true,
  537       object:      'User',
  538       name:        'password',
  539       display:     'Password',
  540       data_type:   'input',
  541       data_option: {
  542         type:         'password',
  543         maxlength:    100,
  544         null:         true,
  545         autocomplete: 'off',
  546         item_class:   'formGroup--halfSize',
  547       },
  548       editable:    false,
  549       active:      true,
  550       screens:     {
  551         signup:          {
  552           '-all-' => {
  553             null: false,
  554           },
  555         },
  556         invite_agent:    {},
  557         invite_customer: {},
  558         edit:            {
  559           Admin: {
  560             null: true,
  561           },
  562         },
  563         view:            {}
  564       },
  565       to_create:   false,
  566       to_migrate:  false,
  567       to_delete:   false,
  568       position:    1400,
  569     )
  570 
  571     # rubocop:disable Lint/BooleanSymbol
  572     ObjectManager::Attribute.add(
  573       force:       true,
  574       object:      'User',
  575       name:        'vip',
  576       display:     'VIP',
  577       data_type:   'boolean',
  578       data_option: {
  579         null:       true,
  580         default:    false,
  581         item_class: 'formGroup--halfSize',
  582         options:    {
  583           false: 'no',
  584           true:  'yes',
  585         },
  586         translate:  true,
  587       },
  588       editable:    false,
  589       active:      true,
  590       screens:     {
  591         edit: {
  592           Admin: {
  593             null: true,
  594           },
  595           Agent: {
  596             null: true,
  597           },
  598         },
  599         view: {
  600           '-all-' => {
  601             shown: false,
  602           },
  603         },
  604       },
  605       to_create:   false,
  606       to_migrate:  false,
  607       to_delete:   false,
  608       position:    1490,
  609     )
  610     # rubocop:enable Lint/BooleanSymbol
  611 
  612     ObjectManager::Attribute.add(
  613       force:       true,
  614       object:      'User',
  615       name:        'note',
  616       display:     'Note',
  617       data_type:   'richtext',
  618       data_option: {
  619         type:      'text',
  620         maxlength: 250,
  621         null:      true,
  622         note:      'Notes are visible to agents only, never to customers.',
  623       },
  624       editable:    false,
  625       active:      true,
  626       screens:     {
  627         signup:          {},
  628         invite_agent:    {},
  629         invite_customer: {
  630           '-all-' => {
  631             null: true,
  632           },
  633         },
  634         edit:            {
  635           '-all-' => {
  636             null: true,
  637           },
  638         },
  639         view:            {
  640           '-all-' => {
  641             shown: true,
  642           },
  643         },
  644       },
  645       to_create:   false,
  646       to_migrate:  false,
  647       to_delete:   false,
  648       position:    1500,
  649     )
  650 
  651     ObjectManager::Attribute.add(
  652       force:       true,
  653       object:      'User',
  654       name:        'role_ids',
  655       display:     'Roles',
  656       data_type:   'checkbox',
  657       data_option: {
  658         default:  '',
  659         multiple: true,
  660         null:     false,
  661         relation: 'Role',
  662       },
  663       editable:    false,
  664       active:      true,
  665       screens:     {
  666         signup:          {},
  667         invite_agent:    {},
  668         invite_customer: {},
  669         edit:            {
  670           Admin: {
  671             null: false,
  672           },
  673         },
  674         view:            {
  675           '-all-' => {
  676             shown: false,
  677           },
  678         },
  679       },
  680       to_create:   false,
  681       to_migrate:  false,
  682       to_delete:   false,
  683       position:    1600,
  684     )
  685 
  686     ObjectManager::Attribute.add(
  687       force:       true,
  688       object:      'User',
  689       name:        'active',
  690       display:     'Active',
  691       data_type:   'active',
  692       data_option: {
  693         null:    true,
  694         default: true,
  695       },
  696       editable:    false,
  697       active:      true,
  698       screens:     {
  699         signup:          {},
  700         invite_agent:    {},
  701         invite_customer: {},
  702         edit:            {
  703           Admin: {
  704             null: false,
  705           },
  706         },
  707         view:            {
  708           '-all-' => {
  709             shown: false,
  710           },
  711         },
  712       },
  713       to_create:   false,
  714       to_migrate:  false,
  715       to_delete:   false,
  716       position:    1800,
  717     )
  718 
  719   end
  720 
  721 end