Jump to content

Edit History

ps8modules

ps8modules

Just save this script in the root of the eshop and run it.
Add missing profiles for CMS pages to the database.

<?php

/* 'id_profile' => '1' = Admin profile */

include('./config/config.inc.php');
include('./init.php');

$db = Db::getInstance();

$existCmsCreate = $db->getValue('SELECT id_authorization_role FROM '._DB_PREFIX_.'authorization_role WHERE slug = \'ROLE_MOD_TAB_ADMINCMSCONTENT_CREATE\'');
$existCmsDelete = $db->getValue('SELECT id_authorization_role FROM '._DB_PREFIX_.'authorization_role WHERE slug = \'ROLE_MOD_TAB_ADMINCMSCONTENT_DELETE\'');
$existCmsRead = $db->getValue('SELECT id_authorization_role FROM '._DB_PREFIX_.'authorization_role WHERE slug = \'ROLE_MOD_TAB_ADMINCMSCONTENT_READ\'');
$existCmsUpdate = $db->getValue('SELECT id_authorization_role FROM '._DB_PREFIX_.'authorization_role WHERE slug = \'ROLE_MOD_TAB_ADMINCMSCONTENT_UPDATE\'');

// ROLE_MOD_TAB_ADMINCMSCONTENT_CREATE
if (!$existCmsCreate) {
    $db->insert('authorization_role',
        array(
            'slug' => 'ROLE_MOD_TAB_ADMINCMSCONTENT_CREATE'
        )
    );
    $insertedId = $db->Insert_ID();
    $db->insert('access',
        array(
            'id_profile' => '1',
            'id_authorization_role' => $insertedId
        )
    );

    echo 'added ROLE_MOD_TAB_ADMINCMSCONTENT_CREATE<br>';
} else {
    $checkIfExistsInAccessCmsCreate = $db->getValue('SELECT id_profile FROM '._DB_PREFIX_.'access WHERE id_authorization_role = '.$existCmsCreate);

    if (!$checkIfExistsInAccessCmsCreate)  {
        $db->insert('access',
            array(
                'id_profile' => '1',
                'id_authorization_role' => $existCmsCreate
            )
        );    
    }
}

// ROLE_MOD_TAB_ADMINCMSCONTENT_DELETE
if (!$existCmsDelete) {
    $db->insert('authorization_role',
        array(
            'slug' => 'ROLE_MOD_TAB_ADMINCMSCONTENT_DELETE'
        )
    );
    $insertedId = $db->Insert_ID();
    $db->insert('access',
        array(
            'id_profile' => '1',
            'id_authorization_role' => $insertedId
        )
    );

    echo 'added ROLE_MOD_TAB_ADMINCMSCONTENT_DELETE<br>';
} else {
    $checkIfExistsInAccessCmsDelete = $db->getValue('SELECT id_profile FROM '._DB_PREFIX_.'access WHERE id_authorization_role = '.$existCmsDelete);

    if (!$checkIfExistsInAccessCmsDelete)  {
        $db->insert('access',
            array(
                'id_profile' => '1',
                'id_authorization_role' => $existCmsDelete
            )
        );    
    }
}

// ROLE_MOD_TAB_ADMINCMSCONTENT_READ
if (!$existCmsRead) {
    $db->insert('authorization_role',
        array(
            'slug' => 'ROLE_MOD_TAB_ADMINCMSCONTENT_READ'
        )
    );
    $insertedId = $db->Insert_ID();
    $db->insert('access',
        array(
            'id_profile' => '1',
            'id_authorization_role' => $insertedId
        )
    );

    echo 'added ROLE_MOD_TAB_ADMINCMSCONTENT_READ<br>';
}  else {
    $checkIfExistsInAccessCmsRead = $db->getValue('SELECT id_profile FROM '._DB_PREFIX_.'access WHERE id_authorization_role = '.$existCmsRead);

    if (!$checkIfExistsInAccessCmsRead)  {
        $db->insert('access',
            array(
                'id_profile' => '1',
                'id_authorization_role' => $existCmsRead
            )
        );    
    }
}

// ROLE_MOD_TAB_ADMINCMSCONTENT_UPDATE
if (!$existCmsUpdate) {
    $db->insert('authorization_role',
        array(
            'slug' => 'ROLE_MOD_TAB_ADMINCMSCONTENT_UPDATE'
        )
    );
    $insertedId = $db->Insert_ID();
    $db->insert('access',
        array(
            'id_profile' => '1',
            'id_authorization_role' => $insertedId
        )
    );

    echo 'added ROLE_MOD_TAB_ADMINCMSCONTENT_UPDATE<br>';
}  else {
    $checkIfExistsInAccessCmsUpdate = $db->getValue('SELECT id_profile FROM '._DB_PREFIX_.'access WHERE id_authorization_role = '.$existCmsUpdate);

    if (!$checkIfExistsInAccessCmsUpdate)  {
        $db->insert('access',
            array(
                'id_profile' => '1',
                'id_authorization_role' => $existCmsUpdate
            )
        );  
    }
}

 

ps8modules

ps8modules

Just save this script in the root of the eshop and run it.
Add missing profiles for CMS pages to the database.

<?php

/* 'id_profile' => '1' = Admin profile */

include('./config/config.inc.php');
include('./init.php');

$db = Db::getInstance();

$existCmsCreate = $db->getValue('SELECT id_authorization_role FROM '._DB_PREFIX_.'authorization_role WHERE slug = \'ROLE_MOD_TAB_ADMINCMSCONTENT_CREATE\'');
$existCmsDelete = $db->getValue('SELECT id_authorization_role FROM '._DB_PREFIX_.'authorization_role WHERE slug = \'ROLE_MOD_TAB_ADMINCMSCONTENT_DELETE\'');
$existCmsRead = $db->getValue('SELECT id_authorization_role FROM '._DB_PREFIX_.'authorization_role WHERE slug = \'ROLE_MOD_TAB_ADMINCMSCONTENT_READ\'');
$existCmsUpdate = $db->getValue('SELECT id_authorization_role FROM '._DB_PREFIX_.'authorization_role WHERE slug = \'ROLE_MOD_TAB_ADMINCMSCONTENT_UPDATE\'');

// ROLE_MOD_TAB_ADMINCMSCONTENT_CREATE
if (!$existCmsCreate) {
    $db->insert('authorization_role',
        array(
            'slug' => 'ROLE_MOD_TAB_ADMINCMSCONTENT_CREATE'
        )
    );
    $insertedId = $db->Insert_ID();
    $db->insert('access',
        array(
            'id_profile' => '1',
            'id_authorization_role' => $insertedId
        )
    );

    echo 'added ROLE_MOD_TAB_ADMINCMSCONTENT_CREATE<br>';
}

// ROLE_MOD_TAB_ADMINCMSCONTENT_DELETE
if (!$existCmsDelete) {
    $db->insert('authorization_role',
        array(
            'slug' => 'ROLE_MOD_TAB_ADMINCMSCONTENT_DELETE'
        )
    );
    $insertedId = $db->Insert_ID();
    $db->insert('access',
        array(
            'id_profile' => '1',
            'id_authorization_role' => $insertedId
        )
    );

    echo 'added ROLE_MOD_TAB_ADMINCMSCONTENT_DELETE<br>';
}

// ROLE_MOD_TAB_ADMINCMSCONTENT_READ
if (!$existCmsRead) {
    $db->insert('authorization_role',
        array(
            'slug' => 'ROLE_MOD_TAB_ADMINCMSCONTENT_READ'
        )
    );
    $insertedId = $db->Insert_ID();
    $db->insert('access',
        array(
            'id_profile' => '1',
            'id_authorization_role' => $insertedId
        )
    );

    echo 'added ROLE_MOD_TAB_ADMINCMSCONTENT_READ<br>';
}

// ROLE_MOD_TAB_ADMINCMSCONTENT_UPDATE
if (!$existCmsUpdate) {
    $db->insert('authorization_role',
        array(
            'slug' => 'ROLE_MOD_TAB_ADMINCMSCONTENT_UPDATE'
        )
    );
    $insertedId = $db->Insert_ID();
    $db->insert('access',
        array(
            'id_profile' => '1',
            'id_authorization_role' => $insertedId
        )
    );

    echo 'added ROLE_MOD_TAB_ADMINCMSCONTENT_UPDATE<br>';
}

 

×
×
  • Create New...