Class PermAccessProvider
java.lang.Object
com.tccc.kos.commons.kab.provider.perm.PermAccessProvider
- All Implemented Interfaces:
KabAccessProvider
This class gathers KAB file permissions, then sets them for each KAB entry
in the
KabAccessProvider
interface's setAccess(KabEntry)
method.
It achieves this by keeping track of permission rules given in ".perm" files. The format of these perm files is:
permissions:userId:groupId:fileMatchPatternWhere:
permissions : the standard unix-style permissions for owner|group|other userId : integer value of the owning user (1 = root) groupId : integer value of the owning group (1 = root) fileMatchPattern : simple matching pattern that uses "*" as wildcardsHere's an example of matching patterns:
644:1:2:home.html matches this one file in the current directory 755:3:4:*.sh matches all "*.sh" files in the current directory 640:5:6:**/*.css matches all "*.css" files in the current and all subdirectories 744:7:8:**/our*.js matches all "our*.js" files in the current and all subdirectoriesNOTE:/ is HTML for "/", which is to indicate that these strings begin with [star][star][slash]. (have to write it this way, otherwise Java sees it as end-of-doc block)
- Version:
- 2022-06-24
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPermFileContents
(String permFullFileName, String permFileContents) AddspermFileContents
to ourrulesMap
.void
Sets the uid (userId), gid (groupId), and permissions for the given KabEntry.
-
Constructor Details
-
PermAccessProvider
public PermAccessProvider()
-
-
Method Details
-
addPermFileContents
AddspermFileContents
to ourrulesMap
.- Parameters:
permFullFileName
- full filename (including directory) of the perm filepermFileContents
- the contents of the given perm file
-
setAccess
Sets the uid (userId), gid (groupId), and permissions for the given KabEntry. If no specific permissions found, then use permissions=444, userId=1, groupId=1.- Specified by:
setAccess
in interfaceKabAccessProvider
- Parameters:
kabEntry
- the kabEntry to apply access control data to
-