RE: Best way to check for user 'Administrator' groupmembership

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



True this solution will work, but it requires you to double your efforts
and maintain the membership of the Administrators group and a text file
.. Of course you could just have a scheduled task(hourly,daily,etc)  to
go through and enumerate your admin group and populate the text file ..
I think as a best practice however you should avoid authorization based
on text files when you can.



-----Original Message-----
From: Svensson, B.A.T. (HKG) [mailto:B.A.T.Svensson@xxxxxxx] 
Sent: Wednesday, February 25, 2004 10:21 AM
To: php-windows@xxxxxxxxxxxxx
Subject: RE:  Best way to check for user 'Administrator'
groupmembership

Well, we are talking about very trivial routine programming here, which
has a million different solutions. Here is another one:


% cat userlvls.txt
user1;0
user2;0
user3;0
admin1;1
admin2;1
%


function get_user_lvl($user_name) {

  $userLevel = LVL_ORDINARY_USER;

  if (($fp = fopen("userlvl.txt", "r"))) {
    bNotFound = true;
    while (feof($fp)) && bNotFound) {
      $userdata = explode(";", fgets($fp));
      if ($userdata[0] == $username) {
        bNotFound = flase;
        $userLevel = $userdata[1];
      }
    }
  }		
  return $userLevel;
}

(Above function written straight in this e-mail without testing so it
probably full of errors, but the main idea is still holding true...)

Then I leave it as an exercise for the reader to find out how to
maintain the user level file userlvl.txt....

On Wed, 2004-02-25 at 16:01, Bowden, Zeb wrote:
> When you say member of the administrators group do you mean a member 
> of the local admin group on your webserver machine? The iswritable 
> solution won't work because you will be writing to the file in the 
> security context of the account under which IIS is running (Network 
> Service
> probably)
> 
> I think the easiest thing for you to do is use a tool in the windows 
> 2000 or 2003 resource kit called "showgrps.exe" ... The 2k3 resource 
> kit is free so you should be able to grab it and use
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Paul Menard [mailto:paulmenard1@xxxxxxxxx]
> Sent: Wednesday, February 25, 2004 9:44 AM
> To: trystano@xxxxxxx; b.a.t.svensson@xxxxxxx; 
> php-windows@xxxxxxxxxxxxx
> Subject: Re:  Best way to check for user 'Administrator' 
> group membership
> 
> Okay, well first I do not wish to complicate the maintenance of the 
> system by requiring dual setup, once on the windows user level and 
> another in the database to adjust the user group membership. And no I 
> do not want to add a fancy form page that will allow me to do this 
> task. At this point I have over 600 accounts on the system. The 
> requirements were to use system-level user authentication not a 
> database. So I would have to build a table to contain the accounts and

> keep this sync'd with the adding/deleting of users which is a separate

> part of the system that I have no control over.
> 
> But thanks for the suggestion.
> 
> FPM
> 
> 
> --- trystano@xxxxxxx wrote:
> > Have an entry in your MySQL databases that states a/the users level 
> > (admin, user etc). Then when they attempt to login check against 
> > this value against their username/password credentials and then 
> > determine
> the logic yourself.
> > 
> > You could even have a dropdown box populate with the types of 
> > admin/user etc and then compare this value with the 
> > username/password in the database etc
> > 
> > Its not to difficult, you just need to think about it.
> > 
> > Tryst
> > 
> > --
> > PHP Windows Mailing List (http://www.php.net/) To unsubscribe,
visit: 
> > http://www.php.net/unsub.php
> > 
> 
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php

--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux