[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

1957.0. "A script to notify users that they can share a drw" by SIOG::T_REDMOND (Thoughts of an Idle Mind) Mon Dec 14 1992 11:23

    Another script from U.S. Fall DECUS.  This time it's one to insert an
    entry for a drawer into the FILECAB.DAT of any user who is privileged
    to access that drawer.  A number of people made the point (at DECUS)
    that after the SFCP migration script had successfully converted old
    shared drawers into the new format, there was still quite a lot of work
    to add entries for the drawers into users' FILECABs.
    
    Note that this script must be run from a privileged account (it uses
    NEWDIR).  Also that the name of the drawer is specified in the format
    used by FILECAB (display name) rather than PARTITION (unique name). You
    may want to change the script so that it accepts the unique name of a
    drawer (for instance, [REDMOND]SHARED_DOCUMENTS) and works from that.
    
    Have fun, Tony
    
    
!+	
!	SFCP_TELL_EVERYONE.SCP
!+
.LABEL START

	GET OA$DISPLAY = OA$_GBL_WORKING \FORCE
	DELETE_FILE OA$TEMP:ACLS.TMP
	GET #ACL_FOUND = 0
	GET #ORIG_USER = OA$USER
	GET #FC_UNIQUE_NAME = FILECAB.UNIQUE_NAME[#FC_DRM_DRAWER]
	GET #FC_DRAWER_NAME = FILECAB.%KEY[#FC_DRM_DRAWER]
	GET #FC_DESCRIPTION = FILECAB.DESCRIPTION[#FC_DRM_DRAWER]
	GET #FC_OWNER = PARTITION.OWNER[FILECAB.UNIQUE_NAME[#FC_DRM_DRAWER]]
	GET #FC_ADR_PARTITION = "0::"

!	Find out where ACCESS.DAT is located for the drawer

	GET #FC_DRM_FILE = -
	   PARTITION.DIRECTORY[FILECAB.UNIQUE_NAME[#FC_DRM_DRAWER]] -
	   "ACCESS.DAT"

!	Check that there is an ACL on ACCESS.DAT

	FOR FIRST ACL$:#FC_DRM_FILE DO GET #ACL_FOUND = 1
	.IF #ACL_FOUND EQ 0 THEN .GOTO NO_ACL_FOUND

!	Walk down through the identifiers on ACCESS.DAT and create a file
!	that we can use to drive NEWDIR with...

	TEXT_FILE OPEN/WRITE ACL_FILE "OA$TEMP:ACLS.TMP"
	FOR ACL$:#FC_DRM_FILE DO -
	   TEXT_FILE WRITE ACL_FILE .IDENTIFIER

	TEXT_FILE CLOSE ACL_FILE
	DUMP_CACHE

	DISPLAY Beginning to process FILECAB pointers . . . \FORCE

	TEXT_FILE OPEN/READ ACL_FILE "OA$TEMP:ACLS.TMP"

.LABEL LOOP_USERS

	TEXT_FILE READ ACL_FILE #NEXT_USER
	.IF OA$STATUS EQ 0 THEN .GOTO ALL_DONE

!	We have an identifier - start to determine whether or not we should
!	do any processing with it
	GET #ACL_USER = #NEXT_USER:30
	GET #THIS_USER_VMS = PROFIL.VMSUSR[#ACL_USER]

!	Don't process the user who owns the drawer
	.IF #THIS_USER_VMS EQS #FC_OWNER THEN .GOTO LOOP_USERS

!	Process groups in a special manner ('cos we have to expand them)
	.IF #ACL_USER:1 EQS "*" THEN .GOTO PROCESS_GROUP

!	And don't try and process someone that can't be found in the profile
	.IF PROFIL.USER[#ACL_USER] EQS "" THEN .GOTO LOOP_USERS

!	Go and NEWDIR to the user account
	GET #THIS_USER = OA$USER
	GET OA$FUNCTION = "NEWDIR " #ACL_USER

!	Did we manage to NEWDIR?	
	.IF #THIS_USER = OA$USER THEN .GOTO CANT_NEWDIR

!	Check that the drawer exists...

	GET #FC_DRAWER_PRESENT = 0
	FOR FIRST FILECAB WITH (.UNIQUE_NAME:30 == #FC_UNIQUE_NAME:30) -
		AND (.PARTITION EQS #FC_ADR_PARTITION) -
	   DO GET #FC_DRAWER_PRESENT = 1

!	Add the drawer - but only if it doesn't already exist in FILECAB
	GET #FC_WRITE_STATUS = 1
	.IF #FC_DRAWER_PRESENT EQ 0  
	.THEN  
	  WRITE ADD FILECAB NAME = #FC_DRAWER_NAME, -
		     UNIQUE_NAME = #FC_UNIQUE_NAME, -
	               PARTITION = #FC_ADR_PARTITION, -
	                 LASTDOC = "", -
                       INDICATOR = "0", -
		     DESCRIPTION = #FC_DESCRIPTION
	  GET #FC_WRITE_STATUS = OA$STATUS
	.END_IF

	.IF #FC_WRITE_STATUS EQ 0
	.THEN
	    GET OA$DISPLAY = "Error writing drawer into " OA$USER "'s FILECAB"
	    FORCE
	.END_IF

	.GOTO LOOP_USERS

.LABEL PROCESS_GROUP
!	Process a group here...

	GET #ACL_GROUP_NAME = #ACL_USER:30:1
	FOR GROUP$:#ACL_GROUP_NAME DO -
	   GET #ACL_GRP_USER = .%KEY \\-
	   GET #GRP_USER_THERE = PROFIL.USER[#ACL_GRP_USER] \\-
	   .IF #GRP_USER_THERE NES "" -
	    THEN -
	     GET OA$FUNCTION = "NEWDIR " #ACL_GRP_USER \\\\-
	     GET #FC_DRAWER_PRESENT = 0 \\\\-
	     FOR FIRST FILECAB WITH (.UNIQUE_NAME:30 == #FC_UNIQUE_NAME:30)  -
	       AND (.PARTITION EQS #FC_ADR_PARTITION) -
	          DO GET #FC_DRAWER_PRESENT = 1 \\\\-
	     .IF #FC_DRAWER_PRESENT EQ 0 -
	      THEN -
	       WRITE ADD FILECAB NAME = #FC_DRAWER_NAME,-
		 UNIQUE_NAME = #FC_UNIQUE_NAME, -
		 INDICATOR = "0", -
		 DESCRIPTION = #FC_DESCRIPTION, -
		 PARTITION = #FC_ADR_PARTITION, -
	 	 LASTDOC = "" -
	      ELSE  -
		OA$NULL

	.GOTO LOOP_USERS

.LABEL ALL_DONE

	GET OA$FUNCTION = "NEWDIR " #ORIG_USER
	TEXT_FILE CLOSE ACL_FILE
!	DELETE_FILE OA$TEMP:ACLS.TMP
	DISPLAY Details written into user FILECAB.DATs
	.EXIT

.LABEL CANT_NEWDIR

	GET OA$DISPLAY = "Unable to NEWDIR to " #ACL_USER
	FORCE
	.GOTO LOOP_USER

.LABEL NO_ACL_FOUND

	GET OA$DISPLAY = "No Access Control List on " #FC_DRM_FILE
	.EXIT

! Author: Tony Redmond 
!
! Modified by: 		 | Date:                | Reason:
!-----------------------------------------------------------------------------
! Tony Redmond           | 08-Dec-1992 07:12pm  | Element created, please state
!                        |                      | modifications down here

!	A script to insert pointers to a drawer in everyone's FILECAB.DAT
!


    
T.RTitleUserPersonal
Name
DateLines
1957.1A script to notify users that they can share a drawerCOL01::KLOCKEFri Jan 15 1993 17:40225
This Version will (hopefully) handle the special Groups *LOCAL and *WORLD
as well. In that case all ALL-IN-1 users will get an entry for the shared 
drawer.
If a user wants to share his default drawer the drawername will be converted
to [user]drawername to avoid duplicate key errors.

Here is the result:

!+
!       SFCP_TELL_EVERYONE.SCP
!+
.LABEL START

        GET OA$DISPLAY = OA$_GBL_WORKING \FORCE
        DELETE_FILE OA$TEMP:ACLS.TMP
        GET #ACL_FOUND = 0
        GET #ORIG_USER = OA$USER
        GET #FC_UNIQUE_NAME = FILECAB.UNIQUE_NAME[#FC_DRM_DRAWER]
        GET #FC_DRAWER_NAME = FILECAB.%KEY[#FC_DRM_DRAWER]
        GET #FC_DESCRIPTION = FILECAB.DESCRIPTION[#FC_DRM_DRAWER]
        GET #FC_OWNER = PARTITION.OWNER[FILECAB.UNIQUE_NAME[#FC_DRM_DRAWER]]
        GET #FC_ADR_PARTITION = "0::"
!
!+JKL 15.01.1993
!       If the DRAWER is the users DEFAULT-DRAWER the DRAWER-Name will be
!       converted to [user]drawername to avoid duplikate key errors
        .IF OA$CURDWR_DEFAULT = "1"
        .THEN
          GET #FC_DRAWER_NAME = "[" #FC_OWNER "]" #FC_DRAWER_NAME
        .END_IF
!-JKL 15.01.1993
!
!       Find out where ACCESS.DAT is located for the drawer

        GET #FC_DRM_FILE = -
           PARTITION.DIRECTORY[FILECAB.UNIQUE_NAME[#FC_DRM_DRAWER]] -
           "ACCESS.DAT"

!       Check that there is an ACL on ACCESS.DAT

        FOR FIRST ACL$:#FC_DRM_FILE DO GET #ACL_FOUND = 1
        .IF #ACL_FOUND EQ 0 THEN .GOTO NO_ACL_FOUND

!       Walk down through the identifiers on ACCESS.DAT and create a file
!       that we can use to drive NEWDIR with...

        TEXT_FILE OPEN/WRITE ACL_FILE "OA$TEMP:ACLS.TMP"
        FOR ACL$:#FC_DRM_FILE DO -
           TEXT_FILE WRITE ACL_FILE .IDENTIFIER

        TEXT_FILE CLOSE ACL_FILE
        DUMP_CACHE

        DISPLAY Beginning to process FILECAB pointers . . . \FORCE

        TEXT_FILE OPEN/READ ACL_FILE "OA$TEMP:ACLS.TMP"

.LABEL LOOP_USERS

        TEXT_FILE READ ACL_FILE #NEXT_USER
        .IF OA$STATUS EQ 0 THEN .GOTO ALL_DONE

!       We have an identifier - start to determine whether or not we should
!       do any processing with it
        GET #ACL_USER = #NEXT_USER:30
        GET #THIS_USER_VMS = PROFIL.VMSUSR[#ACL_USER]

!       Don't process the user who owns the drawer
        .IF #THIS_USER_VMS EQS #FC_OWNER THEN .GOTO LOOP_USERS

!       Process groups in a special manner ('cos we have to expand them)
        .IF #ACL_USER:1 EQS "*" THEN .GOTO PROCESS_GROUP

!       And don't try and process someone that can't be found in the profile
        .IF PROFIL.USER[#ACL_USER] EQS "" THEN .GOTO LOOP_USERS

!       Go and NEWDIR to the user account
        GET #THIS_USER = OA$USER
        GET OA$FUNCTION = "NEWDIR " #ACL_USER

!       Did we manage to NEWDIR?
        .IF #THIS_USER = OA$USER THEN .GOTO CANT_NEWDIR

!       Check that the drawer exists...

        GET #FC_DRAWER_PRESENT = 0
        FOR FIRST FILECAB WITH (.UNIQUE_NAME:30 == #FC_UNIQUE_NAME:30) -
                AND (.PARTITION EQS #FC_ADR_PARTITION) -
           DO GET #FC_DRAWER_PRESENT = 1

!       Add the drawer - but only if it doesn't already exist in FILECAB
        GET #FC_WRITE_STATUS = 1
        .IF #FC_DRAWER_PRESENT EQ 0
        .THEN
          WRITE ADD FILECAB NAME = #FC_DRAWER_NAME, -
                     UNIQUE_NAME = #FC_UNIQUE_NAME, -
                       PARTITION = #FC_ADR_PARTITION, -
                         LASTDOC = "", -
                       INDICATOR = "0", -
                     DESCRIPTION = #FC_DESCRIPTION
          GET #FC_WRITE_STATUS = OA$STATUS
        .END_IF

        .IF #FC_WRITE_STATUS EQ 0
        .THEN
            GET OA$DISPLAY = "Error writing drawer into " OA$USER "'s FILECAB"
            FORCE
        .END_IF

        .GOTO LOOP_USERS

.LABEL PROCESS_GROUP
!       Process a group here...

        GET #ACL_GROUP_NAME = #ACL_USER:30:1
!
!+JKL 14.01.1993
!       If special Group-id as "LOCAL" (*LOCAL) or "*" (*WORLD)
!       then notify all ALL-IN-1 Users
!
        .IF #ACL_GROUP_NAME = "LOCAL" THEN .GOTO PROCESS_PROFILE
        .IF #ACL_GROUP_NAME = "" THEN .GOTO PROCESS_PROFILE
!
!-JKL 14.01.1993
!
        FOR GROUP$:#ACL_GROUP_NAME DO -
           GET #ACL_GRP_USER = .%KEY \\-
           GET #GRP_USER_THERE = PROFIL.USER[#ACL_GRP_USER] \\-
           .IF #GRP_USER_THERE NES "" -
            THEN -
             GET OA$FUNCTION = "NEWDIR " #ACL_GRP_USER \\\\-
             GET #FC_DRAWER_PRESENT = 0 \\\\-
             FOR FIRST FILECAB WITH (.UNIQUE_NAME:30 == #FC_UNIQUE_NAME:30)  -
               AND (.PARTITION EQS #FC_ADR_PARTITION) -
                  DO GET #FC_DRAWER_PRESENT = 1 \\\\-
             .IF #FC_DRAWER_PRESENT EQ 0 -
              THEN -
               WRITE ADD FILECAB NAME = #FC_DRAWER_NAME,-
                 UNIQUE_NAME = #FC_UNIQUE_NAME, -
                 INDICATOR = "0", -
                 DESCRIPTION = #FC_DESCRIPTION, -
                 PARTITION = #FC_ADR_PARTITION, -
                 LASTDOC = "" -
              ELSE  -
                OA$NULL

        .GOTO LOOP_USERS

!
!+JKL 14.01.1993
!       If special Group-id as "LOCAL" (*LOCAL) or "*" (*WORLD)
!       then notify all ALL-IN-1 Users
!
.LABEL PROCESS_PROFILE

!
!       Do not proceed for accounts without VMSUSER ("X400" etc.)
!       and some special users like "POSTMASTER,IVP,A1$SCRIPT"!
!
        FOR PROFIL WITH .VMSUSR NES "" -
          AND .USER NES "IVP" -
          AND .USER NES "A1$SCRIPT" -
          AND .USER NES "POSTMASTER" DO -
            GET #ACL_GRP_USER = .USER \\ -
            GET OA$FUNCTION = "NEWDIR " #ACL_GRP_USER \\-
            GET #FC_DRAWER_PRESENT = 0 \\-
            FOR FIRST FILECAB WITH (.UNIQUE_NAME:30 == #FC_UNIQUE_NAME:30)  -
              AND (.PARTITION EQS #FC_ADR_PARTITION) -
                DO GET #FC_DRAWER_PRESENT = 1 \\-
            .IF #FC_DRAWER_PRESENT EQ 0 -
              THEN -
                WRITE ADD FILECAB NAME = #FC_DRAWER_NAME,-
                  UNIQUE_NAME = #FC_UNIQUE_NAME, -
                  INDICATOR = "0", -
                  DESCRIPTION = #FC_DESCRIPTION, -
                  PARTITION = #FC_ADR_PARTITION, -
                  LASTDOC = "" -
               ELSE  -
                 OA$NULL

        .GOTO LOOP_USERS
!
!-JKL 14.01.1993
!

.LABEL ALL_DONE

        GET OA$FUNCTION = "NEWDIR " #ORIG_USER
        TEXT_FILE CLOSE ACL_FILE
!       DELETE_FILE OA$TEMP:ACLS.TMP
        DISPLAY Details written into user FILECAB.DATs
        .EXIT

.LABEL CANT_NEWDIR

        GET OA$DISPLAY = "Unable to NEWDIR to " #ACL_USER
        FORCE
        .GOTO LOOP_USER

.LABEL NO_ACL_FOUND

        GET OA$DISPLAY = "No Access Control List on " #FC_DRM_FILE
        .EXIT

! Author: Tony Redmond
!
! Modified by:           | Date:                | Reason:
!-----------------------------------------------------------------------------
! Tony Redmond           | 08-Dec-1992 07:12pm  | Element created, please state
!                        |                      | modifications down here
!                        |                      |
! J�rg Klocke            | 14-Jan-1993 16:45    | Prozesses Profile if Group =
!                        |                      | "LOCAL" or "WORLD"
!                        |                      |
! J�rg Klocke            | 15-Jan-1993 17:30    | If the default DRAWER is
!                        |                      | to be populated, the DRAWER
!                        |                      | name (KEY) will be changed to
!                        |                      | "[owningusername]drawername"
!                        |                      | ([REDMOND]MAIN)
!                        |                      |
!                        |                      |
!-----------------------------------------------------------------------------
!
!       A script to insert pointers to a drawer in everyone's FILECAB.DAT
!
1957.2*LOCAL isn't all local usersIOSG::TALLETTGimmee an Alpha colour notebook...Mon Jan 18 1993 09:4618
    
    	I like your modification to add [username] onto the drawername
    	but I'm not sure your processing of *LOCAL is right.
    
    	Contrary to popular belief, *LOCAL does NOT mean all users local
    	to this system. It actually means all processes with the LOCAL
    	identifier which means only processes created for a terminal
    	directly connected to this machine. So, for example, if you log in
    	via LAT you CAN access the drawer, but if you SET HOST you CAN'T
    	access the drawer.
    
    	Also the File Cab Server doesn't have the LOCAL identifier so you
    	can't do cross-drawer refiles etc with *LOCAL.
    
    	I don't think it makes sense to process *LOCAL as you have done.
    
    Regards,
    Paul
1957.3Also not via modemsIOSG::SHOVEDave Shove -- REO2-G/M6Mon Jan 18 1993 10:1911
    Correction to Paul's last:
    
So, for example, if you log in
    	via LAT you CAN access the drawer, but if you SET HOST you CAN'T
    	access the drawer.
    

    Actually, only for a direct connection to the LAT. A connection via
    modem gets the DIALUP identifier instead (I just looked at mine).
    
    Dave.

1957.4Change requestIOSG::MAURICEBecause of the architect the building fell downMon Jan 18 1993 11:457
    I'd recommend that you don't use the [user]drawername syntax within
    FILECAB. If you look in the Create Drawer script you will notice that
    this syntax is invalid. 
    
    Cheers
    
    Stuart
1957.5FCS does not need LOCALCHRLIE::HUSTONMon Jan 18 1993 13:3915
    
    re .2
    
    >	Also the File Cab Server doesn't have the LOCAL identifier so you
    >	can't do cross-drawer refiles etc with *LOCAL.
    
    True, the FCS does not run with LOCAL, but it does run with sysprv, and
    the drawer should be setup with system access, else anything you try 
    that uses the FCS will fail.
    
    The FCS also has a bug in it that it does not understand *LOCAL, this
    is already logged.
    
    --Bob
    
1957.6Thanks for your thoughtsCOL01::KLOCKEWed Jan 27 1993 16:3619
I agree, that there is no sense in processing the PROFILE for the group
*LOCAL. The group was misunderstood by me. On the other hand it does not harm,
exept of understandingproblems on userside, why he once can and once cannot 
access the specific drawer.


to  reply .4

During creation of a drawer the brackets [] are not allowed, because the 
drawer name is used to build the unique drawer id, which uses brackest as well.
But there is no problem renaming your drawer using brackets after it is created
once. The script does not create any new drawer but enters entries to the 
filecab's using an existing "unique drawer id" and gives just a modified name 
to the drawername.


Cheers

J�rg Klocke
1957.7LITTLE BUG IN SCRIPTCOLA1::KLOCKEJ�rg KlockeWed Feb 03 1993 17:1611
    I FOUND A LITTLE BUG IN MY SCRIPT ...
    
    
    IN ALL .IF STATEMENTS THE "=" SHOULD BE REPLACED BY "EQS"!
    
    OTHERWISE IF ANY GROUP IS FOUND THE PROCESS FOR THE WORLDGROUP
    WILL BE EXECUTED.
    
    SORRY 
    
    J�RG