Logo Search packages:      
Sourcecode: aegir-provision version File versions  Download package

provision_user_in_group ( user,
group 
)

Check whether a user is a member of a group.

Parameters:
user username or user id of user.
group groupname or group id of group.
Returns:
Boolean. True if user does belong to group, and FALSE if the user does not belong to the group, or either the user or group do not exist.

Definition at line 211 of file provision.inc.

References provision_posix_groupname(), and provision_posix_username().

                                                {
  // TODO: make these singletons with static variables for caching.
  $user = provision_posix_username($user);
  $group = provision_posix_groupname($group);
  if ($user && $group) {
    $info = posix_getgrnam($group);
    if (in_array($user, $info['members'])) {
      return TRUE;
    }
  }
  return FALSE;
}


Generated by  Doxygen 1.6.0   Back to index