Server config information in the about dialog should be only visible to admin users. #6769

pull/6929/head
Pravesh Sharma 2023-11-03 14:37:25 +05:30 committed by GitHub
parent 9eb7c1cbea
commit 01d1e6f706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 52 deletions

View File

@ -59,26 +59,30 @@ def index():
info = {}
# Get OS , NW.js, Browser details
browser, os_details, nwjs_version = detect_browser(request)
admin = is_admin(current_user.email)
if nwjs_version:
info['nwjs'] = nwjs_version
info['browser_details'] = browser
info['os_details'] = os_details
info['config_db'] = config.SQLITE_PATH
info['log_file'] = config.LOG_FILE
info['version'] = config.APP_VERSION
if config.SERVER_MODE:
info['app_mode'] = gettext('Server')
admin = is_admin(current_user.email)
info['admin'] = admin
else:
info['app_mode'] = gettext('Desktop')
info['browser_details'] = browser
info['version'] = config.APP_VERSION
info['admin'] = admin
info['current_user'] = current_user.email
if admin:
settings = ""
info['os_details'] = os_details
info['log_file'] = config.LOG_FILE
# If external datbase is used do not display SQLITE_PATH
if not config.CONFIG_DATABASE_URI:
info['config_db'] = config.SQLITE_PATH
for setting in dir(config):
if not setting.startswith('_') and setting.isupper() and \
setting not in ['CSRF_SESSION_KEY',

View File

@ -101,6 +101,7 @@ export default function AboutComponent() {
<InputLabel>{aboutData.browser_details}</InputLabel>
</Grid>
</Grid>
{ aboutData.os_details &&
<Grid container spacing={0} style={{marginBottom: '8px'}}>
<Grid item lg={3} md={3} sm={3} xs={12}>
<InputLabel style={{fontWeight: 'bold'}}>{gettext('Operating System')}</InputLabel>
@ -109,6 +110,8 @@ export default function AboutComponent() {
<InputLabel>{aboutData.os_details}</InputLabel>
</Grid>
</Grid>
}
{ aboutData.config_db &&
<Grid container spacing={0} style={{marginBottom: '8px'}}>
<Grid item lg={3} md={3} sm={3} xs={12}>
<InputLabel style={{fontWeight: 'bold'}}>{gettext('pgAdmin Database File')}</InputLabel>
@ -117,6 +120,8 @@ export default function AboutComponent() {
<InputLabel>{aboutData.config_db}</InputLabel>
</Grid>
</Grid>
}
{ aboutData.log_file &&
<Grid container spacing={0} style={{marginBottom: '8px'}}>
<Grid item lg={3} md={3} sm={3} xs={12}>
<InputLabel style={{fontWeight: 'bold'}}>{gettext('Log File')}</InputLabel>
@ -125,8 +130,8 @@ export default function AboutComponent() {
<InputLabel>{aboutData.log_file}</InputLabel>
</Grid>
</Grid>
{ (aboutData.app_mode == 'Desktop' || (aboutData.app_mode == 'Server' && aboutData.admin)) &&
<>
}
{ aboutData.settings &&
<Box flexGrow="1" display="flex" flexDirection="column">
<Box>
<span style={{fontWeight: 'bold'}}>{gettext('Server Configuration')}</span>
@ -141,7 +146,6 @@ export default function AboutComponent() {
value={aboutData.settings}/>
</Box>
</Box>
</>
}
</Box>
);