コード例 #1
0
ファイル: VFSManager.java プロジェクト: klemens/openolat
 /**
  * Get the container which security callback affects this item. This searches up the path of
  * parents to see wether it can find any container with a callback. If no callback can be found,
  * null is returned.
  *
  * @param vfsItem
  * @return
  */
 public static VFSContainer findInheritingSecurityCallbackContainer(VFSItem vfsItem) {
   if (vfsItem == null) return null;
   // first resolve delegates of any NamedContainers to get the actual container (might be a
   // MergeSource)
   if (vfsItem instanceof NamedContainerImpl)
     return findInheritingSecurityCallbackContainer(((NamedContainerImpl) vfsItem).getDelegate());
   // special treatment for MergeSource
   if (vfsItem instanceof MergeSource) {
     MergeSource mergeSource = (MergeSource) vfsItem;
     VFSContainer rootWriteContainer = mergeSource.getRootWriteContainer();
     if (rootWriteContainer != null && rootWriteContainer.getLocalSecurityCallback() != null) {
       // if the root write container has a security callback set, it will always override
       // any local securitycallback set on the mergesource
       return rootWriteContainer;
     } else if (mergeSource.getLocalSecurityCallback() != null) {
       return mergeSource;
     } else if (mergeSource.getParentContainer() != null) {
       return findInheritingSecurityCallbackContainer(mergeSource.getParentContainer());
     }
   } else {
     if ((vfsItem instanceof VFSContainer) && (vfsItem.getLocalSecurityCallback() != null))
       return (VFSContainer) vfsItem;
     if (vfsItem.getParentContainer() != null)
       return findInheritingSecurityCallbackContainer(vfsItem.getParentContainer());
   }
   return null;
 }
コード例 #2
0
ファイル: VFSManager.java プロジェクト: klemens/openolat
 /**
  * Get the security callback which affects this item. This searches up the path of parents to see
  * wether it can find any callback. If no callback can be found, null is returned.
  *
  * @param vfsItem
  * @return
  */
 public static VFSSecurityCallback findInheritedSecurityCallback(VFSItem vfsItem) {
   VFSItem inheritingItem = findInheritingSecurityCallbackContainer(vfsItem);
   if (inheritingItem != null) return inheritingItem.getLocalSecurityCallback();
   return null;
 }