                 onChange: (event) ->
                   if this.getValue() == true
                     this.getDialog().setValueOf('permissions', 'signed_in', false)
-                    this.getDialog().setValueOf('permissions', 'roles_mask', '')
+
+                    for role, index in ((CKEDITOR.config['effective_regions'] || {})['roles'] || [])
+                      this.getDialog().setValueOf('permissions', "role_#{role[1]}", false)
               },
               {
                 id: 'signed_in',

    $('.effective-menu').effectiveMenuEditor() # Initialize the EffectiveMenus

    CKEDITOR.dialog.add 'effectiveMenusDialog', (editor) ->
      {
        title: 'Effective Menu Item'
        minWidth: 350,
        minHeight: 200,

          this.effective_menu_item.remove() if this.effective_menu_item.hasClass('new-item')
          this.effective_menu_item = undefined
      }

      # console.log definition
      # definition

      # # So we've built the definition above, now we're going to add one checkbox each for all roles
      # elements = definition['contents'][1]['elements']

      # for effective_role in CKEDITOR.config['effective_regions']['roles']
      #   description = effective_role[0]
      #   role = effective_role[1]
      #   disabled = effective_role[2]



      # definition
