I'm searching for a command that essentially would do the following: check which rights a user has on a file/dir (including ACL) and return it.
E.g. say you have the following directory:
-rw-r--r-- 1 user1 group1 [snip] file1 -rw-rw-r-- 1 user2 group1 [snip] file2 drwxrwx--- 1 user2 group2 [snip] dir1
Then the commands & output should be (if user1 is a member of only group1):
rights user1 file1 => r-- or 4 rights user1 file2 => rw- or 6 rights user1 dir1 => --- or 0
Is there such a command available or which tools/commands can't be used to construct a script which would do it?