[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

691.0. "Limiting the number of drawers a user can create" by SIOG::T_REDMOND (Thoughts of an Idle Mind) Fri May 15 1992 12:29

    During U.S. Spring DECUS many of the attendees expressed some doubt
    regarding the wisdom of allowing users to create as many drawers as
    they would like. Clearly if users treat drawers like folders they could
    end up with a huge number!
    
    In the campground I hacked out some code to prevent a user from
    creating more than a defined number of drawers. Lots of the people at
    DECUS took a copy of this named data, so you may find it at a customer
    site.  
    
    To impose the restriction, select form FC$DRAWER$MGT in Customization
    Management and edit the named data. Replace the current "Create" code
    with the following:
    
    ;;OA$_MO_CREATE;;
    
    XOP "~~CREATE_DRW_NUMBER~~"\
     IFSTATUS\
     FORM FC_CDR\
     IFEXIT\
     CLOSE_PRIOR\
     XOP "~~POST_CDR~~"\
     GET #FC_DRM_DRAWER = OA$CURDWR
    
    ;;~~CREATE_DRW_NUMBER~~;;
    
    GET OA$DISPLAY = OA$_GBL_WORKING\FORCE\
     FOR PARTITION WITH .OWNER:30 == OA$PROFIL_VMSUSR:30 DO OA$NULL\
     GET #FC_DRW_NO = OA$SEL_COUNT\
     .IF #FC_DRM_NO < OA$PROFIL_UFLAG8
     THEN
        GET OA$DISPLAY = "" \\
        GET OA$STATUS = 1
     ELSE
        GET OA$DISPLAY = "Limit of " #FC_DRM_NO " has been reached" \\
        GET OA$STATUS = 0
    
    Be aware of the following points.
    
    1. This code permits a maximum of 9 drawers per user. If you want to
       increase this limit, use another scheme - like combining two profile
       flags together...
    
    2. If another application uses OA$PROFIL_FLAG8 then clearly you had
       better be cautious and chose another field!
    
    3. Don't make the code live without filling UFLAG8 with some values.
       I made this mistake at DECUS and proved how effective the check
       was as no-one was able to create any more drawers!
    
       For example, to allocate everyone a limit of 4 drawers:
    
       FOR PROFIL WITH (.MAIDES = "ALL-IN-1") OR (.MAIDES = "ALLIN1") -
         DO -
          GET #USER = .USER\\-
          GET OA$DISPLAY = "Processing " #USER \\FORCE\\ -
          WRITE CHANGE PROFIL USER = #USER, UFLAG8 = 4
    
    4. The check counts all drawers in PARTITION that are owned by 
       a particular VMS account, not ALL-IN-1 account. This is another
       good reason to allocate a separate VMS account for each ALL-IN-1
       account.  You could create a partition key value from "[" OA$USER
       and "]" and then use FOR to loop for all keys beginning with the
       symbol you've just created, but the [user] convention is not
       strictly necessary...
    
    Have fun,
    
    Tony
T.RTitleUserPersonal
Name
DateLines
691.1A slight modification requiredIOSG::MAURICEA few follicles shortFri May 15 1992 12:5617
    Hi,
    
    I do not recommend that you use this as is. 
    
    The FOR PARTITION loop will be extremely slow on a large system. It
    could be improved dramatically by using the OWNER secondary key. but
    ...
    
    It would be better to allow for the case where many users share a VMS
    account by making the FOR loop be
     
     GET #NAME = "[" OA$PROFIL_USER "]"\
     FOR PARTITION WITH .%KEY = #NAME DO\
    
    Cheers
    
    Stuart
691.2Improvements are always welcomedSIOG::T_REDMONDThoughts of an Idle MindFri May 15 1992 14:1615
    Hi Stuart, 
    
    Thanks for improving the code. I did think about using the #NAME
    approach, but went the other way, probably due to my bad eyes (private
    joke between SM and myself). 
    
    At least DEC specialists can look good if they see the code on a
    customer site.  All you have to do is say, casually, "I know a way to
    improve that lookup", or mention something about using the OWNER
    secondary key.
    
    Now a question, PARTITION has three keys. UNIQUE_NAME is 0, OWNER is 1 
    (or 2), what's the third?  LANGUAGE? UID?
    
    Thanks, Tony
691.3Minor pointsSHALOT::NICODEMWho told you I&#039;m paranoid???Fri May 15 1992 14:4416
	Not that it will make a lot of difference, but the FOR PARTITION...
does not require the DO OA$NULL.  Any FOR loop will still set OA$SEL_COUNT,
even if there is no DO clause.  Example:

	FOR PROFIL

will set OA$SEL_COUNT to the number of entries in PROFILE.DAT.

	However, that wasn't my main point.  I was thinking that to avoid the
problem Tony mentioned about "locking up" accounts when you haven't set User
Flag 8 for all of them, you might want to make the check in the XOP code
conditional -- in other words, *IF* User Flag 8 is not null, *THEN* do the
check.  In this manner, you could use the flag *only* for those you wanted to
limit; all others would operate normally (i.e., standard V3.0).

	F
691.4the third key is....IOSG::HUGHESJiggery PokeryFri May 15 1992 15:179

        R.e .2

        The third key to PARTITION is DRAWER_IUID.


        Catrin.

691.5RetortsSIOG::T_REDMONDThoughts of an Idle MindFri May 15 1992 15:3418
    Re. 4
    
    Thanks for the information.
    
    Re. 3
    
    I don't like leaving FOR loops without anything to do. It just seems
    odd. That's why I leave the DO OA$NULL at the end of a FOR.  You are,
    of course, quite correct to point out that OA$SEL_COUNT is filled
    whether or not the OA$NULL is included.  In fact, I could have
    dispensed with the #FC_DRW_NO symbol totally and just used OA$SEL_COUNT
    throughout the code if I had wanted to, but I guess I just like
    misusing a few extra bytes of memory...
    
    Nice idea to check in named data whether or not the user is "afflicted"
    with a drawer limit.
    
    Tony
691.6You forgot remote drawersCHRLIE::HUSTONMon May 18 1992 15:4314
    
    One other thing to keep in mind, running the partition file will only
    account for drawers stored locally. Once the dist share option is 
    available users will be able to create a drawer in any partition (node)
    in the world that they have access to. This drawer will not be stored
    in the local partition file, it will be stored in the partition file
    that is on the system that physically contains the drawer.
    
    Don't know if you want to count these drawers since they will not take
    up disk space on the local system, but they are still a drawer owned
    and created by a user.
    
    --Bob
    
691.7Is this pure DECUS code?IOSG::TALLETTMaking broccoliWed May 20 1992 20:4611
    Hi Tony!
    
    	Without running the code you gave in .0 I can't tell if this
    	is the same as the code you gave out at DECUS. At DECUS a few
    	people had tried it and it didn't work correctly when you
    	deleted a drawer. If you were at the limit, deleted a drawer,
    	then tried the create again, it would fail....at least that's
    	what they told me...
    
    Regards,
    Paul
691.8I belive it's virtually the sameBUFFER::VICKERSRearranging the DEChairsThu May 21 1992 04:0313
    Paul,

    I believe that you saw the effect of the few user accounts (like all
    but ONE) which had a blank UFLAG field.  The effect on those users was
    that they would be told that they were limited to the current number of
    drawers.  As they deleted their drawers (in the ALL-IN-1 sense) this
    number would go down causing some confusion which is typical of systems
    on which Tony has done magic.  ;')

    Did your glasses survive the trip back?

    Stay mellow,
    don
691.9Same code, but practised safely this time]SIOG::T_REDMONDThoughts of an Idle MindThu May 21 1992 17:267
    It's basically the same code (with the Maurice addition). Don's point
    about allowing users to have some drawers in the first place sorts
    things out....  Goes to prove that you shouldn't move code into the
    live area unless you've tested it first... (from an unprivileged user
    account)
    
    Tony
691.10Doesn't limit drawer creation from Index?KURIUS::DONOHUE_FThu Feb 24 1994 14:3816
    
    Just some input from a customer regarding this implementation.  It
    only addresses checking for the drawer limit that is set when a user
    attempts to create a drawer from the FC menu, but does not impose
    the same checking from the Create option on the FC Index
    (FC$IDR$INDEX).  
    
    This is seen as an important limitation.  anyone else run into this
    concern?  If so, is there any addition to this implementation to
    impose the same limitation from the index?
    
    Thanks in advance,
    
    Faith Donohue
    
    
691.11How much effort do you want to invest?GANTRY::HULLDigital Consulting [Delivery]/MotownFri Feb 25 1994 15:4515
Faith - it sounds like you have 2 choices:  write some new named data
script code similar to the FC menu version which works from the Index, or
possibly remove the option altogether from the Index and put something like

display Option not available from the Index.  Please use the FC menu instead.

in place of the existing code.  If you go with the latter,  keep the old
code in place but just hide it by placing double tildes around the option
name, ie,

;;opt;;     becomes    ;;~~opt~~;;

you get the idea.

	Al
691.12built-in to base now?AIMTEC::WICKS_AAtlanta&#039;s Most (In)famous WelshmanFri Feb 25 1994 16:1610
    faith,
    
    according to some top-secret info there is some sort of code in the PFR to
    do this though whether it is based on Tony's best-seller I don't know.
    You may want to take a look on one of our nodes and see how it's done
    there.
    
    regards,
                      
    Andrew.D.wicks