Multiple Super Admins?

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
nycwebmaster
Veteran Member
Posts: 90
Joined: 2015-11-23 01:02

Multiple Super Admins?

Post by nycwebmaster » 2019-03-02 17:17

How can I modify any application to have more than one super admin?

Is there a file that I can hard code them with user and password so I can circumvent the limitation of only one super admin in appgini?

My main goal is to have more than one super admin to be able to change the record owner. I want to have a few people that is able to change the record owner in all the tables of the database.

bescott53

Re: Multiple Super Admins?

Post by bescott53 » 2019-03-08 13:15

Sure, nycwebmaster,

go to incfunctions.php in the Admin folder

locate the Function get logged admin

and update to this

Code: Select all

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($_SESSION['adminUsername']!=''){
                                                return $_SESSION['adminUsername'];
                                }elseif($_SESSION['memberGroupID']==2){
                                                $_SESSION['adminUsername']=$_SESSION['memberID'];
                                                return $_SESSION['adminUsername'];
                                }else{
                                                return FALSE;
                                }
                }


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

Re: Multiple Super Admins?

Post by a.gneady » 2019-03-13 13:23

Thanks @bescott53 ... Please also check this blog post, which explains a method of modifying AppGini-generated files in a more maintainable manner: https://bigprof.com/blog/appgini/custom ... dmin-area/
: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.

artemisia
Veteran Member
Posts: 59
Joined: 2013-10-01 15:50

Re: Multiple Super Admins?

Post by artemisia » 2019-12-27 18:14

I tried this and it prevented the login dialog from appearing. Using AG 5.81, php7.0, mysql 5.7

I'm trying to allow another admin user to see the Users and admin functions pages. Due to issues with updates and fixes, at present no existing users can login in, only newly created users. Making manual changes to user tables to allow new admin user to be created, but it can't see the admin pages.

Philou
Posts: 7
Joined: 2014-06-15 07:37

Re: Multiple Super Admins?

Post by Philou » 2021-03-16 05:55

Hi,

I have try to follow the post for hack with a hook but the result is an error 500..
probably have I made a mistake but as this thread is pretty old (I use the 5.94) there is perhaps a news version of this getloggegadmin function ?

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Multiple Super Admins?

Post by onoehring » 2021-03-16 08:29

Hi Ahmed,

I just red the blog post you mentioned. Wouldn't it be much easier to check for custom functions first and use AG internal functions if no custom function exists?
This way the developer would be able to create his functions in e.g. /custom (or /hooks/custom) with the same filename you are using e.g. incfunctions.php. You go ahead and include these files first and the original AG files afterwards with something like this

Code: Select all

if (!function_exists('getLoggedInUser')) {
    function getLoggedInUser{
         ....
    }
}
I think this approach is for example used in the CMS Concrete5 (https://Concrete5.org) where all original files to into a different directory than custom files.

Olaf

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

Re: Multiple Super Admins?

Post by pfrumkin » 2021-03-16 13:27

Great idea Olaf!


Post Reply