I'm currently trying to expand my PHP driven intranet site for my company. It essentially functions as a bunch of miscellaneous reports and utilities that I've thrown together and linked to on the internal webserver. Whenever people keep wanting the same task done, I script it if at all possible and throw it up on the intranet page so people can accomplish their task without my help.
So far this is working great, but there are a handful of utilities that need to be restricted to just managers and such. Now, I know I could create a whole registration system to authenticate users like would be done on a public website, but frankly, that's a pain in the ass for everyone involved. All users already have a Linux user account on the same server as apache, so I'm thinking it would be so much better if I could just make a login form that would authenticate users against their system usernames/passwords, and then examine their groups to see if they have the privileges to do what they are trying to do (in which case they would belong to the already existing "managers" group). If I can pull this off it seems like a win-win for everyone. Users don't have to register and remember/maintain/update another set of credentials, and I don't have do to anything extra when I want to add or remove users.
Is this at all possible? If there aren't any pre-existing libraries to do this, could I just do it the direct way and have PHP read in and process /etc/passwd, /etc/shadow, and /etc/group?