windowsProfileGrantSkipReason function
Why an install leaves the profile read grant unapplied (undefined: it
applies it): asked to skip, a service account, or not running as the
owner of the interactive session, whose profile it would open instead.
Implementation
String? windowsProfileGrantSkipReason(
WindowsSandboxUserStatus user, {
bool? skipProfileGrant,
}) {
if (skipProfileGrant == true) return 'skipProfileGrant was set';
const how =
'run the install, or grantWindowsProfileRead() (`srt-win profile ' +
'grant`), as the user whose sessions are to read their profile';
if (_WINDOWS_SERVICE_ACCOUNT_SIDS.contains(user.realUserSid))
return 'the install ran as the service account ${user.realUserSid}, which ' +
'runs no sessions; $how';
if (user.sessionUserSid == null)
return 'the owner of the session this install ran in could not be ' +
'determined, so it is not known whose profile ${user.realUserSid} ' +
'is; $how';
if (user.sessionUserSid!.toUpperCase() != user.realUserSid.toUpperCase())
return 'the install ran as ${user.realUserSid} in a session that belongs ' +
'to ${user.sessionUserSid}; granting would open the installing ' +
"account's profile, not the session owner's; $how";
return null;
}