That's a big "it depends" question...
While it might be easy to figure out if a user is in a certain group by checking the permissions' files, you'd have to check your httpd.conf to see what kind of log format you are using. I'm positive that you can set your log to a combined format that will retain the user accessing a specific resource (by using the authuser token on the CLF (common log format)), but on my servers I only log custom access and errors.
You might want to check out the Module mod_log_config page... HTH!
#!/home/bbq/bin/perl
# Trust no1!
| [reply] |
The $< variable holds the real user ID of the process and the $> holds the effective UID. If you want to know the user id for a script you're writing, use those variables.
I think this is an XYZ Question... perhaps you could tell us what you're trying to accomplish in general? | [reply] |
You'd need to parse the .htgroup file directly probably. The
browser can't give you that information, because it doesn't know.
The webserver won't set it, because the same user may be in several
different groups.
Maybe you could describe exactly what you need the script
to do overall; there may be a better way of going about setting
up your .htaccess structure so that you may not even need the
script to know the group.
| [reply] |
If you're going to have users with different levels of
access, you probably would want to put that info into a
database. By using a module such as mod_auth_db,
mod_auth_dbm, mod_auth_mysql, etc, Apache can get the passwords
from your database for the connecting usernames and handle the authentication.
Once they have authenticated, your CGI script can access the
username from the $ENV{'REMOTE_USER'} variable and then check
the database to get the group/access level of that user.
| [reply] |
i am trying to figure the best of setting different levels of user access on a web page with .htaccess and perl cgi. | [reply] |