I am trying to do file operations depending on logged-in user in my java web application. For this, I have used JNI native implementation to set the fs uid & fs gid to the logged-in user's uid and gid. Now, file operations are allowed only if the logged-in user has permissions.
I also want to retrieve whether the logged-in user has read/write/execute permissions for a file. Tried to use the access, faccessat system calls but they do not seem to be using the fs uid.
How do I get the file permissions for a logged-in user?