[1589] in Moira

home help back first fref pref prev next nref lref last post

adding a list you own to a public list

daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Sat Jun 17 13:47:26 2000

Message-Id: <200006171747.NAA10828@leo.mit.edu>
To: moiradev@MIT.EDU
Date: Sat, 17 Jun 2000 13:47:23 EDT
From: Garry Zacheiss <zacheiss@MIT.EDU>

	This implements the feature people have requested in the past of
allowing users to add a list they own to a public list, or to remove a
list they own from any list.  Not urgently needed or anything, but
someone mentioned it to me last night and it wasn't hard to implement.

Garry

Index: qaccess.pc
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/server/qaccess.pc,v
retrieving revision 2.16
diff -c -r2.16 qaccess.pc
*** qaccess.pc	2000/06/02 19:46:21	2.16
--- qaccess.pc	2000/06/17 06:26:48
***************
*** 127,138 ****
  int access_list(struct query *q, char *argv[], client *cl)
  {
    EXEC SQL BEGIN DECLARE SECTION;
!   int list_id, acl_id, flags, gid, users_id;
    char acl_type[LIST_ACL_TYPE_SIZE], name[LIST_NAME_SIZE], *newname;
    EXEC SQL END DECLARE SECTION;
    int status;
  
    list_id = *(int *)argv[0];
    EXEC SQL SELECT acl_id, acl_type, gid, publicflg, name
      INTO :acl_id, :acl_type, :gid, :flags, :name
      FROM list
--- 127,140 ----
  int access_list(struct query *q, char *argv[], client *cl)
  {
    EXEC SQL BEGIN DECLARE SECTION;
!   int list_id, acl_id, flags, gid, users_id, member_id, member_acl_id;
    char acl_type[LIST_ACL_TYPE_SIZE], name[LIST_NAME_SIZE], *newname;
+   char member_acl_type[LIST_ACL_TYPE_SIZE];
    EXEC SQL END DECLARE SECTION;
    int status;
  
    list_id = *(int *)argv[0];
+   member_id = *(int *)argv[2];
    EXEC SQL SELECT acl_id, acl_type, gid, publicflg, name
      INTO :acl_id, :acl_type, :gid, :flags, :name
      FROM list
***************
*** 142,148 ****
      return MR_INTERNAL;
  
    /* Allow client to add self to public list or delete self from any
!    * list.
     */
    if ((((!strcmp("amtl", q->shortname) ||
  	 !strcmp("atml", q->shortname)) && flags) ||
--- 144,151 ----
      return MR_INTERNAL;
  
    /* Allow client to add self to public list or delete self from any
!    * list.  Also allow client to add a list they own to a public list
!    * and remove a list they own from any list.
     */
    if ((((!strcmp("amtl", q->shortname) ||
  	 !strcmp("atml", q->shortname)) && flags) ||
***************
*** 152,157 ****
--- 155,171 ----
  	return MR_SUCCESS;
        if (!strcmp("KERBEROS", argv[1]) && *(int *)argv[2] == -cl->client_id)
  	return MR_SUCCESS;
+       if (!strcmp("LIST", argv[1]))
+ 	  {
+ 	    EXEC SQL SELECT acl_id, acl_type INTO :member_acl_id, 
+ 	      :member_acl_type 
+ 	      FROM list
+ 	      WHERE list_id = :member_id; 
+ 	   
+ 	    if (find_member(member_acl_type, member_acl_id, cl))
+ 	      return MR_SUCCESS;
+ 	  }
+ 	    
      } /* if update_list, don't allow them to change the GID or rename to
  	 a username other than their own */
    else if (!strcmp("ulis", q->shortname))

home help back first fref pref prev next nref lref last post