• Aucun résultat trouvé

SHARED FILES

Dans le document The Michigan Terminal System (Page 121-126)

FILES AND DEVICES

SHARED FILES

MTS provides extensive file-sharing capabilities. When a file is created, the owner (i.e., the

“userID” under which the file was created) has unlimited access to it and all other users have no access to it (unless the NEWFILEACCESS global SET option has been used). However, the owner may allow various levels of file access to other userIDs. Private files that may be accessed by userIDs different from the owner are called shared files. Sharing is implemented via the PERMIT command and the NEWFILEACCESS global SET option. In order to permit access to a file, access information must be given which specifies the type of access the owner wishes to allow and which userIDs are allowed to have this access. After a file is permitted, the userIDs that have access to it may refer to it by prefixing the file name with the userID and the colon (:) shared-file separator character.

Access Types

There are six basic categories of access to a file. Each can be denoted in severalequivalentways.

Category Name Read READ

Write-expand WRITEXP, WE, APPEND Write-change and Empty WRITECHG, WC, EMPTY

Truncate and Renumber TRUNCATE

Destroy and Rename DESTROY, RENAME

Permit PERMIT

Each of these six basic permit categories is independent of the others. Permitting a file using any one of the names for a category is the same as using any of the other names for the same category. All types of access listed in the category are allowed.

There are two different forms of write access:

Write-expandmeans that a user with this access canaddnew lines to the file, but cannot change the lines that are already there. For a sequential file, new lines always are added at the end;

hence, the notation APPEND. For a line file, however, new lines may be inserted anywhere in the file.

Write-changemeans that the user with this access canchangeordelete lines that are already there, but cannot add new ones. He also canemptythe file.

To give a user general write access to a file, the owner must specify both WE and WC (this combination can be specified as WRITE or W).

Permit access means that the users so authorized can change the permit status of the file. There is one special case with regard to permit access: the owner of a file always has permit access for that file.

Otherwise, the owner could get into a situation where he had a file that he could not do anything with (except pay for it).

In general, it will never be necessary to explicitly give a file truncate and renumber access.

Write-expand access will allow a file to be truncated and read-write access (see below) will allow a file to be renumbered.

Several commonly used combinations of categories have been given names of their own; they are:

Combination Name Write-change and Write-expand WRITE

Read and Write-change RWCHG

Read and Write-expand RWEXP

Read, Write-change, RW

and Write-expand

Everything except Permit FULL Everything UNLIM

Default access DEFAULT

No Access NONE

Read, Write-change, and EDIT

Write-expand from the File Editor

Read from the RUN command RUN

Other combinations must be described in terms of either the basic categories or the combinations given above. The combinations are specified by means of a parenthesized list. Thus, to give a user read and destroy access to a file, the owner would specify (R,D).

Accessors

Access to a file may be granted to one or more individual userIDs or to groups of userIDs by specifying one of the following:

xxxx

ID=xxxx

where “xxxx” must be from one to four characters. If less than four characters are specified followed by a question mark (?), the file is permitted to the group of userIDs that begin with those characters (not including the trailing “?”); otherwise, the file is permitted to the single userID specified.

A file may also be permitted to all userIDs belonging to a specific projectID “yyyy” by specifying PROJECT=yyyy

where “yyyy” must be from one to four characters. If less than four characters are specified followed by a question mark (?), a group of projects, all beginning with the characters specified, are given the associated access to the file.

In addition, several specific categories may be used:

OTHERS gives the associated access to all userIDs not specifically permitted via the projectID or userID. This does not include the owner. When a file is created, the access for others is initially NONE. If the owner wishes to change the access to a file, using PERMIT, and fails to specify an explicit accessor, by default, the specified access is given to OTHERS.

ALL gives all userIDs (other than the owner) the associated access to the file,including those specifically permitted. To accomplish this, ALL destroys all previously specified permit access to specific userIDs and projectIDs, and also changes the access for OTHERS to that specified.

Thus, ALL enables the user to eliminate the access granted to specified userIDs and projectIDs;

it does not affect the owner’s access.

ME gives the specified access to the userID issuing the permit command.

OWNER gives the specified access to the userID of the owner of the file (usually the same as ME).

Often it is desirable not only to allow access to ones files by specific userIDs or projectIDs, but also to allow access to data files, for example, by specific programs (object files). To accomplish this, files may have aprogram keyattribute associated with them; this association is set by the CONTROL command.

Data files may be permitted access by object files (with the appropriate program key attribute) by specifying in the PERMIT command

PKEY=key

where “key” is a program key. See the section “Program Keys” for further details on the use of program keys in MTS.

The PERMIT Command

The basic form of the PERMIT command is PERMIT filename [access [accessor]]

where “filename” is the name of the file to be permitted, and “access” and “accessor” specify the access information to be given for the file. If the “accessor” is omitted, it is assumed to be OTHERS; if both

“access” and “accessor” are omitted, they are assumed to be READ and OTHERS, respectively. Thus, PERMIT FYLE READ OTHERS

PERMIT FYLE READ PERMIT FYLE all have the same effect.

In addition, the user may specify several “access-accessor” pairs. The “access” and “accessor” of a pair must be separated by blanks, and the pairs must be separated by commas. Blanks may occur before the comma, after the comma, or both. The form of the PERMIT command thus becomes:

PERMIT filename [access [accessor]] [,access [accessor]]...

For example,

PERMIT FYLE RW 2AGA, READ OTHERS

In addition, the “filename”, “access”, and “accessor” may each consist of a parenthesized list of items, rather than just a single item. The items in such a parenthesized list must be separated by commas, blanks, or both. Thus, the following commands are valid:

PERMIT FYLE READ (ME,OTHERS) PERMIT FYLE READ (2BCA,2BCB,2BCC)

PERMIT (FILEA,FILEB) (RW,DES) 2AGA, R P=ABCD PERMIT DBMSFILE RW PKEY=DBMSPGM

These are processed left to right for each file. Hence, each file in the list is processed in the same manner. This does not mean that each file has the same permit status; that depends on the previous status of each file. Merely issuing a PERMIT command for a file does not necessarily delete the previous specific sharing information, unless ALL is specified. Each “access-accessor” combination specified either replaces a previous sharing entry, adds a new entry, or deletes an entry (if DEFAULT is specified), depending on whether or not one was there before.

A special access type DEFAULT may be used to remove a specific access granted to a userID, projectID, or program key and thus, by default, leave only the access associated with OTHERS to the specified userID, projectID, or program key. For example, if the user first issues

PERMIT FYLE READ OTHERS, UNLIMITED (WXYZ,WABC) and later issues

PERMIT FYLE DEFAULT WXYZ

the second command would remove WXYZ’s unlimited access and leave it with read access. Note that there is nothing special about the owner in this context. Thus,

PERMIT FYLE DEFAULT OWNER

means that the owner has the same access as OTHERS (of course, the owner always retains permit access). DEFAULT may be abbreviated as DEF.

One additional option on the PERMIT command is available. The sharing capabilities enable the user to build up very complex sharing lists for a file. In such cases, it is useful for the user to be able to

copy sharing information from one file to another, so that it does not have to be reentered. This is possible with the LIKE option. The form is

PERMIT filename1 LIKE filename2

which copies the specific sharing information, the default access, and the owner access from

“filename2” to “filename1” replacing any sharing information already associated with the file. The user must have permit access tobothfiles to be able to do this. Additional sharing information may be applied to “filename1” by adding the word EXCEPT and the “access-accessor” pairs, as in the normal form of the PERMIT command:

PERMIT filename1 LIKE filename2 EXCEPT access [accessor]

The additional sharing information is applied to “filename1”afterthe information from “filename2” has been applied. Moreover, either “filename1” or “filename2”, or both, may be a parenthesized list of files.

The information given after EXCEPT may enhance or restrict access to “filename1” depending on the

“access-accessor” lists. Several “access-accessor” pairs may be given in the same manner specified above.

Files may be permitted to an initial substring of a userID or projectID by specifying from one to three characters followed by a question mark (?). Therefore, it may happen that a single userID and associated projectID may potentially have more than one type of access. In these cases, the actual access is resolved (in the absence of program keys) according to the following rules:

(1) If a file is permitted to a given userID and also to its associated projectID, the userID always takes precedence. Furthermore, if a file has been permitted in such a way that more than one match may occur on a userID, then the PERMIT command that specifies the greatest number of characters that match the userID takes precedence. For example, for a file that has been permitted both

PERMIT filename READ 2AG?

and

PERMIT filename RW 2AGA

then the user with userID 2AGA has RW access to that file, but user 2AGB has only READ access.

(2) If a file is not permitted to a specific userID, but is permitted to its associated projectID, then the user implicitly has the access to that file associated with that projectID.

ProjectIDs, like userIDs, may be specified by 1 to 4 characters, and thus the same potential for conflicts exists when determining accessibility. As in the case of userIDs, the ambiguity is resolved according to the greatest number of matching characters.

Thus, for example, in a file that is permitted both PERMIT filename READ P=2BC?

and

PERMIT filename NONE P=2BCB

all userIDs that have projectIDs 2BCA, 2BCC, 2BCD, etc., have READ access to that file,

while userIDs that have projectID 2BCB have no access.

(3) If a file has not been specifically permitted for either userID or projectID, the access that has been specified for OTHERS is used. The default access for OTHERS is NONE.

See the section “Program Keys” for details on using the PERMIT command with program keys.

The NEWFILEACCESS option of the SET command establishes a new default access to be given to all new files created by the CREATE command. This command is given in the form

SET NEWFILEACCESS='access accessor'

where “access” and “accessor” is same access/accessor pair that may be specified with the PERMIT command. For example, the command

SET NEWFILEACCESS='READ P=ABCD'

will give READ access to project ABCD for all new files created. This access may be removed later, either for all userIDs in the project or for an individual userID. For example, issuing the command

PERMIT DATA DEFAULT ABC1

removes READ access from the individual userID ABC1 for the file DATA.

The initial default access is UNLIM OWNER, and may be restored by giving the command SET NEWFILEACCESS=OFF

The FILESTATUS command can be used to determine the access to a file.

Dans le document The Michigan Terminal System (Page 121-126)