Class: CamaleonCms::UserRole

Inherits:
TermTaxonomy
  • Object
show all
Defined in:
app/models/camaleon_cms/user_role.rb

Overview

Camaleon CMS is a content management system

Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  GNU Affero General Public License (GPLv3) for more details.

Constant Summary collapse

ROLES =
{
    post_type: [
        {
            key: 'edit',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.html_create_or_edit')}",
            color: 'success',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.create_or_edit')}"
        },
        {
            key: 'edit_other',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.html_edit_other')}",
            color: 'success',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.edit_other')}"
        },
        {
            key: 'edit_publish',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.html_edit_publish')}",
            color: 'success',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.edit_publish')}"
        },
        {
            key: 'publish',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.publish')}",
            color: 'success',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.publish')}"
        },
        {
            key: 'delete',
            label: "#{I18n.t('camaleon_cms.admin.button.delete')}",
            color: 'danger',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.delete')}"
        },
        {
            key: 'delete_other',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.html_delete_other')}",
            color: 'danger',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.delete_other')}"
        },
        {
            key: 'delete_publish',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.html_delete_publish')}",
            color: 'danger',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.delete_publish')}"
        },
        #{
        #    key: 'read_private',
        #    label: "#{I18n.t('camaleon_cms.admin.users.roles_values.html_read_private')}",
        #    color: 'info',
        #    description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.read_private')}"
        #},
        {
            key: 'manage_categories',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.html_manage_categories')}",
            color: 'warning',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.manage_categories')}"
        },
        {
            key: 'manage_tags',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.html_manage_tags')}",
            color: 'warning',
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.manage_tags')}"
        }
    ],
    manager: [
        {
            key: 'media',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.media')}",
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.media')}"
        },
        {
            key: 'comments',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.comments')}",
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.comments')}"
        },
        {
            key: 'themes',
            label: "#{I18n.t('camaleon_cms.admin.users.roles_values.themes')}",
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.themes')}"
        },
        {
            key: 'widgets',
            label: "#{I18n.t('camaleon_cms.admin.sidebar.widgets')}",
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.widgets')}"
        },
        {
            key: 'nav_menu',
            label: "#{I18n.t('camaleon_cms.admin.sidebar.menus')}",
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.menus')}"
        },
        {
            key: 'plugins',
            label: "#{I18n.t('camaleon_cms.admin.sidebar.plugins')}",
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.plugins')}"
        },
        {
            key: 'users',
            label: "#{I18n.t('camaleon_cms.admin.sidebar.users')}",
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.users')}"
        },
        {
            key: 'settings',
            label: "#{I18n.t('camaleon_cms.admin.sidebar.settings')}",
            description: "#{I18n.t('camaleon_cms.admin.users.tool_tip.settings')}"
        }
    ]
}

Instance Method Summary collapse

Methods inherited from TermTaxonomy

#children, #in_nav_menu_items, #set_options_from_form, #skip_slug_validation?

Methods included from CustomFieldsRead

#add_custom_field_group, #add_custom_field_to_default_group, #get_field!, #get_field_groups, #get_field_object, #get_field_value, #get_field_values, #get_field_values_hash, #get_fields_object, #get_user_field_groups, #save_field_value, #set_field_values, #update_field_value

Methods included from Metas

#delete_meta, #delete_option, #fix_save_metas_options_no_changed, #get_meta, #get_option, #options, #save_metas_options, #save_metas_options_skip, #set_meta, #set_multiple_options, #set_option

Instance Method Details

#editable?Boolean

Returns:

  • (Boolean)

24
25
26
# File 'app/models/camaleon_cms/user_role.rb', line 24

def editable?
    term_group.nil?
end

#roles_managerObject


20
21
22
# File 'app/models/camaleon_cms/user_role.rb', line 20

def roles_manager
  self.get_meta("_manager")
end

#roles_post_typeObject


16
17
18
# File 'app/models/camaleon_cms/user_role.rb', line 16

def roles_post_type
  self.get_meta("_post_type")
end