CodeIgniter Forums
How to activate debugging role wise? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How to activate debugging role wise? (/showthread.php?tid=80313)



How to activate debugging role wise? - sr13579 - 10-16-2021

For a live project how can I hide debugging feature for normal user?
I just want to show it only for developers.
Please give me a solution.


RE: How to activate debugging role wise? - kenjis - 10-16-2021

Set your environment to `production`.
See https://codeigniter4.github.io/CodeIgniter4/general/environments.html#the-environment-constant


RE: How to activate debugging role wise? - sr13579 - 10-16-2021

(10-16-2021, 06:04 PM)kenjis Wrote: Set your environment to `production`.
See https://codeigniter4.github.io/CodeIgniter4/general/environments.html#the-environment-constant

This is not how it is done I guess. I need to show it to only certain role. Like admin for example.


RE: How to activate debugging role wise? - nfaiz - 10-16-2021

(10-16-2021, 04:47 PM)sr13579 Wrote: For a live project how can I hide debugging feature for normal user?
I just want to show it only for developers.
Please give me a solution.

app/Config/Boot/production.php
PHP Code:
<?php

/*
 |--------------------------------------------------------------------------
 | ERROR DISPLAY
 |--------------------------------------------------------------------------
 | Don't show ANY in production environments. Instead, let the system catch
 | it and display a generic error message.
 */
ini_set('display_errors''0');
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);

/*
 |--------------------------------------------------------------------------
 | DEBUG MODE
 |--------------------------------------------------------------------------
 | Debug mode is an experimental flag that can allow changes throughout
 | the system. It's not widely used currently, and may not survive
 | release of the framework.
 */

if (is_developer()) {
    defined('CI_DEBUG') || define('CI_DEBUG'true);
} else {
    defined('CI_DEBUG') || define('CI_DEBUG'false);




RE: How to activate debugging role wise? - InsiteFX - 10-17-2021

You can also try this out, but make sure you read it on php.net.

PHP Code:
$ciEnv 'development';

putenv("CI_ENVIRONMENT=$ciEnv"); 

READ:
PHP.net - putenv