Class FolderUserCanAccess


  • public class FolderUserCanAccess
    extends LinkState

    Title: FileCatalyst Direct Server API

    Description: Class that holds a VIEW of a folder a user has access to. A user can have multiple paths to access a folder -- either granting direct access of a folder, or by granting access to a group, and having one or multiple groups being granted to that user. Note that user permissions to folders are stacked, so that if the user has been given read access to a folder directly, but has write access via a group, they are allowed both read and write permissions (see getMaxPermission()). Permissions are not modifiable via this object, nor are they persisted. Calls to the Server API need to be made in order to modify on the server any permission set. Allows viewing/editing of permissions by API caller without exposing the inner permission classes.

    Copyright: Copyright (c) 2013

    Company: Unlimi-Tech Software Inc.

    Since:
    v3.1
    Version:
    1.0
    Author:
    Christian Charette, ccharette
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Custom equals method for this object
      java.lang.String getDescription()
      Return the virtual folder description
      int getDirectPermission()
      Return permission directly set to user (as int value -- see PermissionsContainer.generatePermission() to translate into boolean values)
      java.lang.String getFolder()
      Return the folder name (not label, but database PK) to identify folder in question
      int getGroupPermission​(java.lang.String groupName)
      Returns the permission a user has via a specific group.
      java.util.Collection<java.lang.String> getGroups()
      Return a list of groups that a user has access to which have been granted access to the Virtual Folder.
      java.lang.String getLabel()
      Return the folder label to identify folder in question.
      int getMaxPermission()
      Return maximum permission (as int value -- see PermissionsContainer.generatePermission() to translate into boolean values)
      java.lang.String getName()
      Return the folder name (not label, but database PK) to identify folder in question
      java.lang.String getPath()
      Return the folder path (real system path) which to which the Virtual Folder points to.
      java.lang.String getUser()
      Return the user name
      int hashCode()
      Custom hash-code method for this object
      boolean isDirect()
      See if there is a direct link (ie: not through groups) of the user to a folder.
      boolean isInVirtualFolder​(java.io.File currentFile)
      See if the virtual folder falls within the directory structure of the current file.
      boolean isMultipleUniqueGroupPermissions()
      Returns true if there are more than one group assigned to the user which has access to the virtual folder
      java.lang.String toString()
      Custom toString method for this object
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getFolder

        public java.lang.String getFolder()
        Return the folder name (not label, but database PK) to identify folder in question
        Returns:
        Folder Name
      • getMaxPermission

        public int getMaxPermission()
        Return maximum permission (as int value -- see PermissionsContainer.generatePermission() to translate into boolean values)
        Returns:
        int value representing permission.
      • getDirectPermission

        public int getDirectPermission()
        Return permission directly set to user (as int value -- see PermissionsContainer.generatePermission() to translate into boolean values)
        Returns:
        the directPermission granted to the user. Return -1 if permission is not explicitly set to user but is granted instead via group.
      • isMultipleUniqueGroupPermissions

        public boolean isMultipleUniqueGroupPermissions()
        Returns true if there are more than one group assigned to the user which has access to the virtual folder
        Returns:
        the multipleUniqueGroupPermissions
      • getGroups

        public java.util.Collection<java.lang.String> getGroups()
        Return a list of groups that a user has access to which have been granted access to the Virtual Folder.
        Returns:
        List of group names. Empty collection if access is not granted via groups .
      • getGroupPermission

        public int getGroupPermission​(java.lang.String groupName)
        Returns the permission a user has via a specific group. see PermissionsContainer.generatePermission() to translate into boolean values
        Parameters:
        groupName - Group name
        Returns:
        permission as an int a user has via a specific group. Returns -1 is group is not found.
      • getUser

        public java.lang.String getUser()
        Return the user name
        Returns:
        user name
      • getName

        public java.lang.String getName()
        Return the folder name (not label, but database PK) to identify folder in question
        Specified by:
        getName in class LinkState
        Returns:
        Folder Name
      • getLabel

        public java.lang.String getLabel()
        Return the folder label to identify folder in question. This is the sub-directory link presented to the user when it appears on their home directory.
        Returns:
        Folder label
      • getPath

        public java.lang.String getPath()
        Return the folder path (real system path) which to which the Virtual Folder points to. ie: C:/tmp/. Forward slashes are returned even on Windows machines.
        Returns:
        Folder path
      • isDirect

        public boolean isDirect()
        See if there is a direct link (ie: not through groups) of the user to a folder.
        Returns:
        if there is any link directly from User to Folder this will return true
      • getDescription

        public java.lang.String getDescription()
        Return the virtual folder description
        Returns:
        Virtual Folder description
      • isInVirtualFolder

        public boolean isInVirtualFolder​(java.io.File currentFile)
        See if the virtual folder falls within the directory structure of the current file.
        Parameters:
        currentFile -
        Returns:
        true if the current file is accessible via this virtual folder.
      • toString

        public java.lang.String toString()
        Custom toString method for this object
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Custom hash-code method for this object
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Custom equals method for this object
        Overrides:
        equals in class java.lang.Object