Class DefaultPermissionFacade

  • All Implemented Interfaces:
    PermissionFacade

    public class DefaultPermissionFacade
    extends java.lang.Object
    implements PermissionFacade
    Implementation that returns true for all method calls.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canChangeInstance​(java.lang.Object instance)
      Returns true if the current user is allowed to change this instance.
      boolean canChangeInstanceProperty​(java.lang.Object instance, java.lang.String property)
      Returns true if the current user is allowed to change the specified property at the given instance.
      boolean canChangeInstances​(java.util.Collection<java.lang.Object> instances)
      Returns true if the current user is allowed to change all instances.
      boolean canChangeInstancesProperty​(java.util.Collection<java.lang.Object> instances, java.lang.String qualifier)
      Returns true if the current user is granted change permission to the given property.
      boolean canChangeProperty​(java.lang.String typeCode, java.lang.String property)
      Returns true if the current user is granted change permission to the given property.
      boolean canChangePropertyPermission​(java.lang.String typeCode, java.lang.String property)
      Returns true if the current user is granted "change permission" permission to the given property.
      boolean canChangeType​(java.lang.String typeCode)
      Returns true if the current user is granted change permission to the given type.
      boolean canChangeTypePermission​(java.lang.String typeCode)
      Returns true if the current user is granted "change permission" permission to the given type.
      boolean canCreateTypeInstance​(java.lang.String typeCode)
      Returns true if the current user is granted create permission to instances of the given type.
      boolean canReadInstance​(java.lang.Object instance)
      Returns true if the current user is allowed to read this instance.
      boolean canReadInstanceProperty​(java.lang.Object instance, java.lang.String property)
      Returns true if the current user is allowed to read the specified property at the given instance.
      boolean canReadProperty​(java.lang.String typeCode, java.lang.String property)
      Returns true if the current user is granted read permission to the given property.
      boolean canReadType​(java.lang.String typeCode)
      Returns true if the current user is granted read permission to the given type.
      boolean canRemoveInstance​(java.lang.Object instance)
      Returns true if the current user is allowed to delete this instance.
      boolean canRemoveTypeInstance​(java.lang.String typeCode)
      Returns true if the current user is granted delete permission to an instance of the given type.
      java.util.Set<java.util.Locale> getAllReadableLocalesForCurrentUser()
      Returns a set of locales for which the current user has permission to read localized property values.
      java.util.Set<java.util.Locale> getAllWritableLocalesForCurrentUser()
      Returns a set of locales for which the current user has permission to write localized property values of given instance.
      java.util.Set<java.util.Locale> getEnabledReadableLocalesForCurrentUser()
      Returns a set of enabled locales for which the current user has permission to read localized property values.
      java.util.Set<java.util.Locale> getEnabledWritableLocalesForCurrentUser()
      Returns a set of enabled locales for which the current user has permission to write localized property values of given instance.
      java.util.Set<java.util.Locale> getReadableLocalesForInstance​(java.lang.Object instance)
      Returns a set of locales for which the current user has permission to read localized property values of given instance.
      java.util.Set<java.util.Locale> getWritableLocalesForInstance​(java.lang.Object instance)
      Returns a set of locales for which the current user has permission to write localized property values of given instance.
      void setDefaultAccess​(boolean defaultAccess)  
      void setPermissionFacadeStrategyRegistry​(PermissionFacadeStrategyRegistry permissionFacadeStrategyRegistry)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultPermissionFacade

        public DefaultPermissionFacade()
    • Method Detail

      • canReadType

        public boolean canReadType​(java.lang.String typeCode)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted read permission to the given type. Returns false otherwise.
        Specified by:
        canReadType in interface PermissionFacade
        Parameters:
        typeCode - type
        Returns:
        true if user has read permission, false otherwise
      • canReadProperty

        public boolean canReadProperty​(java.lang.String typeCode,
                                       java.lang.String property)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted read permission to the given property. Returns false otherwise. You should always prefer using PermissionFacade.canReadInstanceProperty(Object, String) if there is an instance available.
        Specified by:
        canReadProperty in interface PermissionFacade
        Parameters:
        typeCode - type of object which property is read
        property - property of object
        Returns:
        true if user has read permission, false otherwise
      • canChangeType

        public boolean canChangeType​(java.lang.String typeCode)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted change permission to the given type. Returns false otherwise.
        Specified by:
        canChangeType in interface PermissionFacade
        Parameters:
        typeCode - type
        Returns:
        true if user has change permission, false otherwise
      • canChangeProperty

        public boolean canChangeProperty​(java.lang.String typeCode,
                                         java.lang.String property)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted change permission to the given property. Returns false otherwise. You should always prefer using PermissionFacade.canChangeInstanceProperty(Object, String) if there is an instance available.
        Specified by:
        canChangeProperty in interface PermissionFacade
        Parameters:
        typeCode - type of object which property is change
        property - property of object
        Returns:
        true if user has change permission, false otherwise
      • canCreateTypeInstance

        public boolean canCreateTypeInstance​(java.lang.String typeCode)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted create permission to instances of the given type. Returns false otherwise.
        Specified by:
        canCreateTypeInstance in interface PermissionFacade
        Parameters:
        typeCode - type
        Returns:
        true if user has create permission, false otherwise
      • canRemoveTypeInstance

        public boolean canRemoveTypeInstance​(java.lang.String typeCode)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted delete permission to an instance of the given type. Returns false otherwise. You should always prefer using PermissionFacade.canRemoveInstance(Object) if there is an instance available.
        Specified by:
        canRemoveTypeInstance in interface PermissionFacade
        Parameters:
        typeCode - type of object
        Returns:
        true if user has delete permission, false otherwise
      • canChangeTypePermission

        public boolean canChangeTypePermission​(java.lang.String typeCode)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted "change permission" permission to the given type. Returns false otherwise.
        Specified by:
        canChangeTypePermission in interface PermissionFacade
        Parameters:
        typeCode - type of object
        Returns:
        true if user has change permission, false otherwise
      • canChangePropertyPermission

        public boolean canChangePropertyPermission​(java.lang.String typeCode,
                                                   java.lang.String property)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted "change permission" permission to the given property. Returns false otherwise.
        Specified by:
        canChangePropertyPermission in interface PermissionFacade
        Parameters:
        typeCode - type of object
        property - property to change
        Returns:
        true if user has change permission, false otherwise
      • getReadableLocalesForInstance

        public java.util.Set<java.util.Locale> getReadableLocalesForInstance​(java.lang.Object instance)
        Description copied from interface: PermissionFacade
        Returns a set of locales for which the current user has permission to read localized property values of given instance. Returns null, if no restrictions are set.
        Specified by:
        getReadableLocalesForInstance in interface PermissionFacade
        Parameters:
        instance - object to read localized property
        Returns:
        set o locales on which user has read permission
      • getWritableLocalesForInstance

        public java.util.Set<java.util.Locale> getWritableLocalesForInstance​(java.lang.Object instance)
        Description copied from interface: PermissionFacade
        Returns a set of locales for which the current user has permission to write localized property values of given instance. Returns null, if no restrictions are set.
        Specified by:
        getWritableLocalesForInstance in interface PermissionFacade
        Parameters:
        instance - object to write localized property
        Returns:
        set o locales on which user has write permission
      • canReadInstanceProperty

        public boolean canReadInstanceProperty​(java.lang.Object instance,
                                               java.lang.String property)
        Description copied from interface: PermissionFacade
        Returns true if the current user is allowed to read the specified property at the given instance. This usually includes a type check, see PermissionFacade.canChangeProperty(String, String).
        Specified by:
        canReadInstanceProperty in interface PermissionFacade
        Parameters:
        instance - object which property is read
        property - property of object
        Returns:
        true if user has read permission, false otherwise
      • canChangeInstanceProperty

        public boolean canChangeInstanceProperty​(java.lang.Object instance,
                                                 java.lang.String property)
        Description copied from interface: PermissionFacade
        Returns true if the current user is allowed to change the specified property at the given instance. This usually includes a type check, see PermissionFacade.canChangeProperty(String, String).
        Specified by:
        canChangeInstanceProperty in interface PermissionFacade
        Parameters:
        instance - object which property is change
        property - property of object
        Returns:
        true if user has change permission, false otherwise
      • canChangeInstancesProperty

        public boolean canChangeInstancesProperty​(java.util.Collection<java.lang.Object> instances,
                                                  java.lang.String qualifier)
        Description copied from interface: PermissionFacade
        Returns true if the current user is granted change permission to the given property. Returns false otherwise.
        Specified by:
        canChangeInstancesProperty in interface PermissionFacade
        Parameters:
        instances - objects to change
        qualifier - property of objects
        Returns:
        true if user has change permission, false otherwise
      • canReadInstance

        public boolean canReadInstance​(java.lang.Object instance)
        Description copied from interface: PermissionFacade
        Returns true if the current user is allowed to read this instance. Returns false otherwise.
        Specified by:
        canReadInstance in interface PermissionFacade
        Parameters:
        instance - object to read
        Returns:
        true if user has read permission, false otherwise
      • canChangeInstance

        public boolean canChangeInstance​(java.lang.Object instance)
        Description copied from interface: PermissionFacade
        Returns true if the current user is allowed to change this instance. Returns false otherwise.
        Specified by:
        canChangeInstance in interface PermissionFacade
        Parameters:
        instance - object to change
        Returns:
        true if user has change permission, false otherwise
      • canChangeInstances

        public boolean canChangeInstances​(java.util.Collection<java.lang.Object> instances)
        Description copied from interface: PermissionFacade
        Returns true if the current user is allowed to change all instances. Returns false otherwise.
        Specified by:
        canChangeInstances in interface PermissionFacade
        Parameters:
        instances - objects to change
        Returns:
        true if user has change permission, false otherwise
      • getAllReadableLocalesForCurrentUser

        public java.util.Set<java.util.Locale> getAllReadableLocalesForCurrentUser()
        Description copied from interface: PermissionFacade
        Returns a set of locales for which the current user has permission to read localized property values. Returns null, if no restrictions are set.
        Specified by:
        getAllReadableLocalesForCurrentUser in interface PermissionFacade
        Returns:
        set o locales on which user has read permission
      • getAllWritableLocalesForCurrentUser

        public java.util.Set<java.util.Locale> getAllWritableLocalesForCurrentUser()
        Description copied from interface: PermissionFacade
        Returns a set of locales for which the current user has permission to write localized property values of given instance. Returns null, if no restrictions are set.
        Specified by:
        getAllWritableLocalesForCurrentUser in interface PermissionFacade
        Returns:
        set o locales on which user has write permission
      • getEnabledReadableLocalesForCurrentUser

        public java.util.Set<java.util.Locale> getEnabledReadableLocalesForCurrentUser()
        Description copied from interface: PermissionFacade
        Returns a set of enabled locales for which the current user has permission to read localized property values. Returns empty set, if no restrictions are set.
        Specified by:
        getEnabledReadableLocalesForCurrentUser in interface PermissionFacade
        Returns:
        set o enabled locales on which user has read permission
      • getEnabledWritableLocalesForCurrentUser

        public java.util.Set<java.util.Locale> getEnabledWritableLocalesForCurrentUser()
        Description copied from interface: PermissionFacade
        Returns a set of enabled locales for which the current user has permission to write localized property values of given instance. Returns empty set, if no restrictions are set.
        Specified by:
        getEnabledWritableLocalesForCurrentUser in interface PermissionFacade
        Returns:
        set o locales on which user has write permission
      • setDefaultAccess

        public void setDefaultAccess​(boolean defaultAccess)