java directory permissions with AccessController.checkPermission

后端 未结 1 1996
感动是毒
感动是毒 2021-01-26 12:30

im trying to get directory permissions via the checkPermission() method, as in the code.

private static boolean dirPermissions(String dir, String perm) {
             


        
相关标签:
1条回答
  • 2021-01-26 13:21

    Firstly you should probably be using the SecurityManager.

    FilePermission copes with directories fine. You probably want to include all the files and directories included below. Use /- at the end for that. Use /* for non-recursive contained files and directories.

    checkPermission will throw an exception if any frame (or rather its ProtectionDomain) of the current access control context (acc) does not have the required permission.

    FilePermission has nothing to do with OS permissions.

    0 讨论(0)
提交回复
热议问题