]> andersk Git - moira.git/commitdiff
Add owner_type, owner_id to new versions of zephyr queries.
authorzacheiss <zacheiss>
Mon, 25 Sep 2000 22:48:48 +0000 (22:48 +0000)
committerzacheiss <zacheiss>
Mon, 25 Sep 2000 22:48:48 +0000 (22:48 +0000)
server/mr_server.h
server/qaccess.pc
server/qfollow.pc
server/queries2.c

index 72beb70ba9e5b490c9a333f4e0926269217d5d70..804e694362fbdb9fa4061af3948743f312cded9a 100644 (file)
@@ -151,6 +151,7 @@ int access_host(struct query *q, char *argv[], client *cl);
 int access_ahal(struct query *q, char *argv[], client *cl);
 int access_snt(struct query *q, char *argv[], client *cl);
 int access_printer(struct query *q, char *argv[], client *cl);
+int access_zephyr(struct query *q, char *argv[], client *cl);
 
 /* prototypes from qfollow.pc */
 int followup_fix_modby(struct query *q, struct save_queue *sq,
index 9ef103e55b263f4850d089a47e9d79bfb2f2a1f0..50c1d0f2e7cf1ca33614eef87468c5730888b6e2 100644 (file)
@@ -583,3 +583,27 @@ int access_printer(struct query *q, char *argv[], client *cl)
   else
     return MR_PERM;
 }
+
+/* access_zephyr */
+int access_zephyr(struct query *q, char *argv[], client *cl)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  char type[ZEPHYR_OWNER_TYPE_SIZE];
+  char *class;
+  int id;
+  EXEC SQL END DECLARE SECTION;
+  int status;
+
+  class = argv[ZA_CLASS];
+  EXEC SQL SELECT owner_type, owner_id INTO :type, :id
+      FROM zephyr WHERE class = :class;
+  if (sqlca.sqlcode)
+    return MR_PERM;
+
+  status = find_member(type, id, cl);
+  if (status)
+    return MR_SUCCESS;
+  else
+    return MR_PERM;
+}
+
index 54854f4b2f75052bc15bf99fa1bd54323bbd1f2b..f1422c6dead400ceea628a2a2216c3665ca63a6b 100644 (file)
@@ -886,14 +886,19 @@ int followup_gzcl(struct query *q, struct save_queue *sq, struct validate *v,
                  int (*action)(int, char *[], void *), void *actarg,
                  client *cl)
 {
-  int i, status;
+  int i, n, status;
   char **argv;
 
+  if (q->version < 5)
+    n = 8;
+  else
+    n = 10;
+
   while (sq_get_data(sq, &argv))
     {
       mr_trim_args(q->vcnt, argv);
 
-      for (i = 1; i < 8; i += 2)
+      for (i = 1; i < n; i += 2)
        {
          status = fix_ace(argv[i], &argv[i + 1]);
          if (status && status != MR_NO_MATCH)
index 6225c490c52df2871aa79272bdedd48cb0d6f2ea..f69616aa5d417f721655a645f643f5c566fd1f7d 100644 (file)
@@ -2337,13 +2337,20 @@ static struct validate dnfq_validate = {
   followup_dqot,
 };
 
-static char *gzcl_fields[] = {
+static char *gzcl2_fields[] = {
   "class",
   "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
   "iws_type", "iws_name", "iui_type", "iui_name",
   "modtime", "modby", "modwith",
 };
 
+static char *gzcl_fields[] = {
+  "class",
+  "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
+  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type",
+  "owner_id", "modtime", "modby", "modwith",
+};
+
 static struct validate gzcl_validate = {
   0,
   0,
@@ -2351,14 +2358,44 @@ static struct validate gzcl_validate = {
   0,
   0,
   0,
-  0,
+  access_zephyr,
   0,
   followup_gzcl,
 };
 
-static char *azcl_fields[] = {
+static char *azcl2_fields[] = {
   "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
   "iws_type", "iws_name", "iui_type", "iui_name",
+};  
+
+static struct valobj azcl2_valobj[] = {
+  {V_CHAR, 0, ZEPHYR_TABLE, "class"},
+  {V_TYPE, 1, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 2, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 3, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 4, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 5, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 6, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 7, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
+};
+
+static struct validate azcl2_validate = {
+  azcl2_valobj,
+  9,
+  "class",
+  "class = '%s'",
+  1,
+  0,
+  0,
+  0,
+  set_zephyr_modtime,
+};
+
+static char *azcl_fields[] = {
+  "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
+  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type", 
+  "owner_id",
 };
 
 static struct valobj azcl_valobj[] = {
@@ -2371,11 +2408,13 @@ static struct valobj azcl_valobj[] = {
   {V_TYPEDATA, 6, 0, 0, "list_id", MR_ACE},
   {V_TYPE, 7, 0, "zace_type", 0, MR_ACE},
   {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 9, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 10, 0, 0, "list_id", MR_ACE},
 };
 
 static struct validate azcl_validate = {
   azcl_valobj,
-  9,
+  11,
   "class",
   "class = '%s'",
   1,
@@ -2385,11 +2424,41 @@ static struct validate azcl_validate = {
   set_zephyr_modtime,
 };
 
-static char *uzcl_fields[] = {
+static char *uzcl2_fields[] = {
   "class", "newclass", "xmt_type", "xmt_name", "sub_type", "sub_name",
   "iws_type", "iws_name", "iui_type", "iui_name",
 };
 
+static struct valobj uzcl2_valobj[] = {
+  {V_NAME, 0, ZEPHYR_TABLE, "class", 0, MR_BAD_CLASS},
+  {V_RENAME, 1, ZEPHYR_TABLE, "class", 0, MR_NOT_UNIQUE},
+  {V_TYPE, 2, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 3, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 4, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 5, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 6, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 7, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 8, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
+};
+
+static struct validate uzcl2_validate = {
+  uzcl2_valobj,
+  10,
+  "class",
+  "class = '%s'",
+  1,
+  0,
+  access_zephyr,
+  0,
+  set_zephyr_modtime,
+};
+
+static char *uzcl_fields[] = {
+  "class", "newclass", "xmt_type", "xmt_name", "sub_type", "sub_name",
+  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type", "owner_id",
+};
+
 static struct valobj uzcl_valobj[] = {
   {V_NAME, 0, ZEPHYR_TABLE, "class", 0, MR_BAD_CLASS},
   {V_RENAME, 1, ZEPHYR_TABLE, "class", 0, MR_NOT_UNIQUE},
@@ -2401,16 +2470,18 @@ static struct valobj uzcl_valobj[] = {
   {V_TYPEDATA, 7, 0, 0, "list_id", MR_ACE},
   {V_TYPE, 8, 0, "zace_type", 0, MR_ACE},
   {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 11, 0, 0, "list_id", MR_ACE},
 };
 
 static struct validate uzcl_validate = {
   uzcl_valobj,
-  10,
+  12,
   "class",
   "class = '%s'",
   1,
   0,
-  0,
+  access_zephyr,
   0,
   set_zephyr_modtime,
 };
@@ -5353,7 +5424,7 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_GZCL - GET_ZEPHYR_CLASS */
+    /* Q_GZCL - GET_ZEPHYR_CLASS, v2 */
     "get_zephyr_class",
     "gzcl",
     2,
@@ -5361,7 +5432,7 @@ struct query Queries[] = {
     "z",
     ZEPHYR_TABLE,
     "class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM zephyr",
-    gzcl_fields,
+    gzcl2_fields,
     12,
     "class LIKE '%s'",
     1,
@@ -5370,7 +5441,24 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_AZCL - ADD_ZEPHYR_CLASS */
+    /* Q_GZCL - GET_ZEPHYR_CLASS, v5 */
+    "get_zephyr_class",
+    "gzcl",
+    5,
+    RETRIEVE,
+    "z",
+    ZEPHYR_TABLE,
+    "class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM zephyr",
+    gzcl_fields,
+    14,
+    "class LIKE '%s'",
+    1,
+    "class",
+    &gzcl_validate,
+  },
+
+  {
+    /* Q_AZCL - ADD_ZEPHYR_CLASS, v2 */
     "add_zephyr_class",
     "azcl",
     2,
@@ -5378,16 +5466,33 @@ struct query Queries[] = {
     "z",
     ZEPHYR_TABLE,
     "INTO zephyr (class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id) VALUES ('%s', '%s', %d, '%s', %d, '%s', %d, '%s', %d)",
-    azcl_fields,
+    azcl2_fields,
     9,
     0,
     0,
     NULL,
+    &azcl2_validate,
+  },
+
+  {
+    /* Q_AZCL - ADD_ZEPHYR_CLASS, v5 */
+    "add_zephyr_class",
+    "azcl",
+    5,
+    APPEND,
+    "z",
+    ZEPHYR_TABLE,
+    "INTO zephyr (class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, owner_type, owner_id) VALUES ('%s', '%s', %d, '%s', %d, '%s', %d, '%s', %d, '%s', %d)",
+    azcl_fields,
+    11,
+    0,
+    0,
+    NULL,
     &azcl_validate,
   },
 
   {
-    /* Q_UZCL - UPDATE_ZEPHYR_CLASS */
+    /* Q_UZCL - UPDATE_ZEPHYR_CLASS, v2 */
     "update_zephyr_class",
     "uzcl",
     2,
@@ -5395,11 +5500,28 @@ struct query Queries[] = {
     "z",
     ZEPHYR_TABLE,
     "zephyr SET class = '%s', xmt_type = '%s', xmt_id = %d, sub_type = '%s', sub_id = %d, iws_type = '%s', iws_id = %d, iui_type = '%s', iui_id = %d",
-    uzcl_fields,
+    uzcl2_fields,
     9,
     "class = '%s'",
     1,
     NULL,
+    &uzcl2_validate,
+  },
+
+  {
+    /* Q_UZCL - UPDATE_ZEPHYR_CLASS, v5 */
+    "update_zephyr_class",
+    "uzcl",
+    5,
+    UPDATE,
+    "z",
+    ZEPHYR_TABLE,
+    "zephyr SET class = '%s', xmt_type = '%s', xmt_id = %d, sub_type = '%s', sub_id = %d, iws_type = '%s', iws_id = %d, iui_type = '%s', iui_id = %d, owner_type = '%s', owner_id = %d",
+    uzcl_fields,
+    11,
+    "class = '%s'",
+    1,
+    NULL,
     &uzcl_validate,
   },
 
This page took 0.073627 seconds and 5 git commands to generate.