I'm not sure why this doesn't work, as other parts of the code do the same. However, this is not what you want anyway: This check would already authenticate, i. e. you would get a password prompt right at the startup of l-s just for checking if you are an administrator. Instead, this should query polkit in "no interactivity" mode (no POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION), and check if it gets a "no but you can authorize" result (sorry, can't research the details here).
But with polkit we can probably just drop the whole is_admin check completely. If a non-admin user is starting l-s, the polkit dialog will still allow you to authenticate as another user who is an admin.
I'm not sure why this doesn't work, as other parts of the code do the same. However, this is not what you want anyway: This check would already authenticate, i. e. you would get a password prompt right at the startup of l-s just for checking if you are an administrator. Instead, this should query polkit in "no interactivity" mode (no POLKIT_ CHECK_AUTHORIZA TION_FLAGS_ ALLOW_USER_ INTERACTION) , and check if it gets a "no but you can authorize" result (sorry, can't research the details here).
But with polkit we can probably just drop the whole is_admin check completely. If a non-admin user is starting l-s, the polkit dialog will still allow you to authenticate as another user who is an admin.