| 699 | } |
| 700 | |
| 701 | FileSecurity getFileSecurity(const QString& path) |
| 702 | { |
| 703 | FileSecurity fs; |
| 704 | |
| 705 | try { |
| 706 | auto sd = getSecurityDescriptor(path); |
| 707 | auto dacl = getDacl(sd.get()); |
| 708 | auto currentUser = getCurrentUser(); |
| 709 | auto owner = getFileOwner(sd.get()); |
| 710 | auto access = getEffectiveRights(dacl, currentUser.get()); |
| 711 | |
| 712 | fs.rights = makeFileRights(access); |
| 713 | |
| 714 | if (EqualSid(owner, currentUser.get())) { |
| 715 | fs.owner = "(this user)"; |
| 716 | } else { |
| 717 | fs.owner = getUsername(owner); |
| 718 | } |
| 719 | } catch (failed& f) { |
| 720 | fs.error = f.what(); |
| 721 | } |
| 722 | |
| 723 | return fs; |
| 724 | } |
| 725 | } // namespace env |
no test coverage detected