## ŒFSTAC Set component-file access matrix

In multi-user versions of APLX, each user can be allocated a unique user number (shown by 1†ŒAI). Individual APLX component files are tagged with a User Number, and have an associated File Access Matrix which indicates which users can access the file, what operations they may perform, and whether they need to specify a pass number to tie the file. Users will be allocated their user number by the logon procedure adopted by their system. Each user can thus 'own' a number of files, and can grant or deny access to these files.

You can change the Access Matrix for a file using the syntax:

          MATRIX ŒFSTAC TIENO {PASS}

The Access Matrix is three columns wide. The first column is a list of user numbers, with 0 being taken to mean ALL users. The second column is a list of integers which indicate the access privileges for the indicated user. The third column is the list of pass numbers which must be used by the given user to access the file with those rights (0 means no pass number is required). The access matrix may have a maximum of 19 rows. When a file is created, the default access matrix allows only the owner to access it, and grants the owner all rights, with no pass number.

TIENO is the tie number you used to tie or create the file (or the tie number returned by APLX if you tied or created it using 0 instead of your own tie number). If you tied the file using a pass number, you must provide the same pass number, as the PASS parameter.

When any operation on a file is attempted, APLX looks through the access matrix to find the first match for the user number (in the first column) and the pass number supplied when the file was tied (in the third column). A user number of 0 in the access matrix matches any user ID. If a match is found, the user is granted the permissions specified by the second element of the row. If no match is found, and the user is not the owner of the file, no permissions are granted. If no match is found, and the user is the owner of the file, all permissions are granted.

The access privileges can be specified in two ways. A positive privilege states what the user can do, and a negative privilege states what the user cannot do.

The privilege code is a number generated by adding various powers of 2 (1, 2, 4, 8, 16,....), each power of 2 corresponding to a particular privilege. Positive privilege codes are merely the sum of the individual privileges granted, whilst negative privilege codes are generated by adding ¯1 and the result of negating the sum of all the privileges denied.

    Power     Value		Operation
    of 2

      0		    1		ŒFREAD
      1		    2		ŒFTIE (exclusive)
      2		    4		ŒFERASE
      3		    8		ŒFAPPEND
      4		   16		ŒFREPLACE ŒFWRITE
      5		   32		ŒFDROP ŒFDELETE
      7		  128		ŒFRENAME
      9		  512		ŒFRDCI ŒFCSIZE
     10		 1024		ŒFRESIZE
     11		 2048		ŒFHOLD
     12		 4096		ŒFRDAC
     13		 8192		ŒFSTAC
     14		16384		ŒFDUP

Permission to use ŒFSTIE (shared tie) is implicitly granted to any user who has any permission to use the file. ŒFCREATE ŒFLIB ŒFNAMES ŒFNUMS and ŒFUNTIE do not need explicit APLX permissions (although the operating-system may restrict your rights). ŒFSIZE does not require explicit permission, but you must supply a pass number if the file was tied with one.

Examples of privilege codes are:

    Privilege   	Meaning

         0      No access
         1      ŒFSTIE ŒFREAD
         3      ŒFSTIE ŒFTIE ŒFREAD
        17      ŒFSTIE ŒFREAD ŒFREPLACE ŒFWRITE
       ¯33      Full access except for ŒFDROP ŒFDELETE
        ¯1      Full access

Topic: APLX Help : Help on APL language : System Functions & Variables : ŒFSTAC Set component-file access matrix

[ Previous | Next | Contents | Index ]