]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add "requesting-user-name" and "my-jobs" attributes to requests as needed.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 4 Aug 2005 20:54:14 +0000 (20:54 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 4 Aug 2005 20:54:14 +0000 (20:54 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@4569 7a7537e8-13f0-0310-91df-b6672ffda945

cgi-bin/classes.c
cgi-bin/jobs.c
cgi-bin/printers.c

index b901b24ddb35578c5bfeda5c6af3fd1cede581ae..5d6bc6eb59ec1b97a2d195a059eb3ead6ed1bd35 100644 (file)
@@ -163,6 +163,10 @@ main(int  argc,                            /* I - Number of command-line arguments */
 
       request->request.op.operation_id = CUPS_GET_CLASSES;
       request->request.op.request_id   = 1;
+
+      if (getenv("REMOTE_USER") != NULL)
+       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
+                     NULL, getenv("REMOTE_USER"));
     }
     else
     {
@@ -237,6 +241,18 @@ main(int  argc,                            /* I - Number of command-line arguments */
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
                      NULL, which_jobs);
 
+      if (getenv("REMOTE_USER") != NULL)
+      {
+       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
+                     NULL, getenv("REMOTE_USER"));
+
+       if (strcmp(getenv("REMOTE_USER"), "root"))
+         ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
+      }
+      else
+       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
+                     NULL, "unknown");
+
       ippGetAttributes(request, TEMPLATES, "jobs.tmpl", getenv("LANG"));
 
      /*
index 46770fdb1a67d92a47527b417175f62087f84b76..1bbf0c44747e005e4b854452afecfac661ccf0df 100644 (file)
@@ -225,8 +225,13 @@ do_job_op(http_t      *http,               /* I - HTTP connection */
                NULL, uri);
 
   if (getenv("REMOTE_USER") != NULL)
+  {
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
                  NULL, getenv("REMOTE_USER"));
+
+    if (strcmp(getenv("REMOTE_USER"), "root"))
+      ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
+  }
   else
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
                  NULL, "unknown");
index 87ebfe2aa956626f37ec02c7bdb4afc314f69b93..293d8b682277ced96941defdcd9f0cca44a8f3c4 100644 (file)
@@ -163,6 +163,10 @@ main(int  argc,                            /* I - Number of command-line arguments */
 
       request->request.op.operation_id = CUPS_GET_PRINTERS;
       request->request.op.request_id   = 1;
+
+      if (getenv("REMOTE_USER") != NULL)
+       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
+                     NULL, getenv("REMOTE_USER"));
     }
     else
     {
@@ -243,6 +247,18 @@ main(int  argc,                            /* I - Number of command-line arguments */
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs",
                      NULL, which_jobs);
 
+      if (getenv("REMOTE_USER") != NULL)
+      {
+       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
+                     NULL, getenv("REMOTE_USER"));
+
+       if (strcmp(getenv("REMOTE_USER"), "root"))
+         ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1);
+      }
+      else
+       ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
+                     NULL, "unknown");
+
       ippGetAttributes(request, TEMPLATES, "jobs.tmpl", getenv("LANG"));
 
      /*