gspool_getspu(3)

NAME
gspool_getspu - retrieve the permissions for a user

SYNOPSIS
#include <gspool.h>

int getspu(const int fd, const char *user, struct apispdet *res)

DESCRIPTION
The function gspool_getspu() is used to retrieve the defaults for a particular user

fd is a file descriptor previously returned by gspool_open

user is a pointer to the username of the user details being retrieved.

res is a descriptor, which upon return will contain the details of user. The structure "apispdet" is defined in the file gsapi.h, and contains the following fields: Valid user ID Reserved User ID Minimum priority Maximum priority Default priority Default form type Allowed form type pattern Default printer Allowed printer pattern Privilege flag Class of printers Maximum copies allowed

The "spu_flgs" field of res will contain a combination of the following: Administrator (edit admin file) Can run sstop (can stop scheduler) Can use other forms than default Can change priority on queue Can change other users' jobs Can move to printer queue Can halt, restart printer Can set any priority on queue Can change own default priority Can add/delete printers Can override class Can unqueue jobs Can view other jobs not neccesarily edit Can access remote jobs Can access remote printers Can save default options Can access sub-screens Can use other printers from default

ALLPRIVS
    A combination of all of the above

RETURN VALUES
The function gspool_getspu() returns 0 if successful otherwise one of the following codes: Invalid user name Invalid File descriptor failure writing to the network failure reading from the network The user does not have permission

EXAMPLE
An example to view the privileges of user "mark":

 int     fd, ret;
 struct apispdet res;

 fd = gspool_open("myhost", (char *)0, 0);
 if (fd < 0) { /* error handling */
     ...
 }

 ret = gspool_getspu(fd, "mark", &res);
 if (ret < 0) { /* error handling */
     ...
 }

 if (res.spu_flags & PV_HALTGO)
     printf("user mark cannot halt printers\n");
 printf("marks maximim priority is %d\n", res.spu_maxp);
 gspool_close(fd);

SEE ALSO
gspool_getspd(3), gspool_putspu(3), gspool_putspd(3).

COPYRIGHT
Copyright (c) 2009 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law.

AUTHOR
John M Collins, Xi Software Ltd.