Additional Admins Cannot See the Admin Area

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
TheCodeRed
Posts: 26
Joined: 2014-05-01 12:57

Additional Admins Cannot See the Admin Area

Post by TheCodeRed » 2014-08-12 13:48

I have an application that has 3 admins assigned. For some reason, it will only display the 'Admin Area' button to the default Admin. The other two just get brough to the homepage and never display the option for the admin section.

If I try to browse directly to the /admin page it will keep asking for a login unless I am already logged in with the default administrator.

Any possible known issues?

apirnar
Veteran Member
Posts: 40
Joined: 2013-04-15 17:06

Re: Additional Admins Cannot See the Admin Area

Post by apirnar » 2014-10-13 06:04

I too have the same issue. Is it the way that's supposed to be? A yes/no would help. Thanks.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Additional Admins Cannot See the Admin Area

Post by a.gneady » 2014-10-14 06:17

Currently, AppGini supports only one "super admin" .. That is the one you define during setup and can be modified later from the admin area > admin settings. All other members of the admins group have full access to all tables but not to the admin area. We plan to change this in the future to support several super admins.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

yak1982
Posts: 1
Joined: 2015-04-26 23:08

Re: Additional Admins Cannot See the Admin Area

Post by yak1982 » 2015-04-26 23:10

Hello. In current version of the app (5.31) this is still an issue. Could you provide Admin group members with ability to get into Admin Area?

Diogenes
Posts: 16
Joined: 2015-05-07 14:03

Re: Additional Admins Cannot See the Admin Area

Post by Diogenes » 2015-05-26 14:44

This sounds like an area that could be handled by a plugin that can be updated separately as AppGini changes and then incorporated as a native function later.

I particularly need to create at least 4 Different permissions that apply to pages and views and permissions, such as
Employees: "Allowed to see pages c, d, h
Page c Add, Delete, Modify
Page d View, List
Page h Add, Delete, Modify, Print, Export"

Employees list: (If I have 45 permissions to set for new employees I see the names in rows and the buttons in columns to Apply and Save)

1) Abby Hil // Radio Buttons: * Admin * Employees * Client * Office staff
2) Jon Blaze // Radio Buttons: * Admin * Employees * Client * Office staff
3) James Cameron // Radio Buttons: * Admin * Employees * Client * Office staff
4) Michelle Strand // Radio Buttons: * Admin * Employees * Client * Office staff

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Additional Admins Cannot See the Admin Area

Post by pfrumkin » 2020-02-18 18:07

Hi
I am a newbie. Is there an update on this post? From what I've seen, AppGini still allows only one super admin.
Thank you.
Paul

SkayyHH
Veteran Member
Posts: 425
Joined: 2015-04-27 21:18

Re: Additional Admins Cannot See the Admin Area

Post by SkayyHH » 2020-06-07 22:07

Hello,

i need more than one super admins too.

Thanks much, Kai

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Additional Admins Cannot See the Admin Area

Post by pfrumkin » 2020-06-08 16:52

I no doubt found this code on this forum somewhere but I don't remember where

Code: Select all

<?php // Save this file as 'hooks/replace-appgini-functions.php'
 $hooks_dir = dirname(__FILE__);
	include("{$hooks_dir}/../defaultLang.php");
	include("{$hooks_dir}/../language.php");
	include("{$hooks_dir}/../lib.php");
	
	// Step 1: Specify the file containing the function we want to overwrite
	$appgini_file = "{$hooks_dir}/../admin/incFunctions.php";
 
	// Step 2: Specify the file containing our version of the function
	$mod_file = "{$hooks_dir}/custom.GetLoggedAdmin.php";
 
	// Step 3: Specify the name of the function we want to overwrite
	$func_name = 'getLoggedAdmin';
 
	echo "<br>{$func_name}: " . replace_function($appgini_file, $func_name, $mod_file);
 
	#######################################
 
	function replace_function($appgini_file, $function_name, $mod_file) {
		// read the new code from the mod file
		$new_code = @file($mod_file);
		if(empty($new_code)) return 'No custom code found.';
 
		// remove the first line containing PHP opening tag and keep the rest as $new_snippet
		array_shift($new_code);
		$new_snippet = implode('', $new_code);
 
		$pattern1 = '/\s*function\s+' . $function_name . '\s*\(.*\).*(\R.*){200}/';
		$pattern2 = '/\t#+(.*\R)*/';
 
		$entire_code = file_get_contents($appgini_file);
		if(!$entire_code) return 'Invalid AppGini file.';
 
		$m = [];
		if(!preg_match_all($pattern1, $entire_code, $m)) return 'Function to replace not found.';
		$snippet = $m[0][0];
 
		if(!preg_match_all($pattern2, $snippet, $m)) return 'Could not find the end of the function.';
		$snippet = str_replace($m[0][0], '', $snippet);
 
		$snippet_nocrlf = str_replace("\r\n", "\n", $snippet);
		$new_snippet_nocrlf = str_replace("\r\n", "\n", $new_snippet);
		if(trim($snippet_nocrlf) == trim($new_snippet_nocrlf)) return 'Function already replaced.';
 
		// back up the file before overwriting
		if(!@copy(
			$appgini_file, 
			preg_replace('/\.php$/', '.backup.' . date('Y.m.d.H.i.s') . '.php', $appgini_file)
		)) return 'Could not make a backup copy of file.';
 
		$new_code = str_replace(trim($snippet), trim($new_snippet), $entire_code);
		if(!@file_put_contents($appgini_file, $new_code)) return "Couldn't overwrite file.";
 
		return 'Function overwritten successfully.';
	}

Code: Select all

	<?php // save this file as 'hooks/custom.getLoggedAdmin.php'
	function getLoggedAdmin() {
		// checks session variables to see whether the admin is logged or not
		// if not, it returns false
		// if logged, it returns the user id

		$adminConfig = config('adminConfig');
		if(!isset($_SESSION['memberID']) || empty($_SESSION['memberID'])) return false;
 
		$current_user = $_SESSION['memberID'];
		$current_user_safe = makeSafe($_SESSION['memberID']);
		$sql = "SELECT COUNT(1) FROM membership_users u 
			LEFT JOIN membership_groups g ON u.groupID = g.groupID
			WHERE LCASE(u.memberID) = LCASE('{$current_user_safe}') AND g.name = 'Admins'";
		$is_admin = sqlValue($sql);
		if(!$is_admin) return false;
 
		$_SESSION['adminUsername'] = $current_user;
		return $current_user;
	}
I don't think I had to change anything. Navigate to /hooks/replace-appgini-functions.php on your site.

rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Re: Additional Admins Cannot See the Admin Area

Post by rpierce » 2021-08-16 17:33

I need more than 1 super admin. Is there any progress on this? I am using the latest version 5.97

mberthiaume
Posts: 5
Joined: 2021-12-07 17:58

Re: Additional Admins Cannot See the Admin Area

Post by mberthiaume » 2024-02-18 22:35

Hi Team APPgini,

I tried the code for the Admin Area, I have the last Version 24.10

The code section was modified in incFunctions.php

Now, I assign an other user in Admins Group
I can see the Link *Admin Aeria* ... so when I click ... can't access ...

Only the master admin define in Preconfigured users and groups can access.

I believe we are near ...

Have you an idea ?

Thank's and have a nice Sunday !

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Additional Admins Cannot See the Admin Area

Post by peebee » 2024-02-26 00:54

appgini-1.jpg
appgini-1.jpg (45.89 KiB) Viewed 216 times
appgini2.jpg
appgini2.jpg (83.22 KiB) Viewed 216 times

Post Reply