Class PermAccessProvider

java.lang.Object
com.tccc.kos.commons.kab.provider.perm.PermAccessProvider
All Implemented Interfaces:
KabAccessProvider

public class PermAccessProvider extends Object implements 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:fileMatchPattern
 
Where:
 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 wildcards
 
Here'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 subdirectories
 
NOTE:/ 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 Details

    • PermAccessProvider

      public PermAccessProvider()
  • Method Details

    • addPermFileContents

      public void addPermFileContents(String permFullFileName, String permFileContents)
      Adds permFileContents to our rulesMap .
      Parameters:
      permFullFileName - full filename (including directory) of the perm file
      permFileContents - the contents of the given perm file
    • setAccess

      public void setAccess(KabEntry kabEntry)
      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 interface KabAccessProvider
      Parameters:
      kabEntry - the kabEntry to apply access control data to