windows:Windows-environment/user-account-control

出自UXGuide.net

跳转到:导航, 搜索

用户帐户控制
User Account Control

A well designed User Account Control experience helps prevent unwanted system-wide changes in a way that is predictable and requires minimal effort.

目录


通过使用“用户帐户控制”(UAC),交互方式下的管理员通常以最小用户特权方式运行,但他们可以通过在授权用户界面中显示授权而自行提升权限以执行管理任务。这类管理任务包括:安装软件和驱动程序、更改系统范围设置、查看或更改其他用户帐户以及运行管理工具。

处于最小特权状态的管理员被称为“受保护的管理员”,而在权限提升时则被称为“权限提升的管理员”。相反,“标准用户”无法自行提升权限,但他们可以让管理员通过凭据用户界面。内置的管理员帐户则无需权限提升。

Aa511445_uac_01(en-us,MSDN_10).png


授权用户界面,用于将受保护管理员提升至拥有管理权限。

Aa511445_uac_02(en-us,MSDN_10).png


凭据用户界面,用于提升标准用户的权限。

UAC 带来了以下好处:

Developers: For implementation information, see Redesign Your UI for UAC Compatibility.

In Windows Vista®, Protected administrators can choose to be notified about all system changes or none. The UAC default setting is to notify about all changes, no matter what their origin. When you're notified, your desktop will be dimmed, and you must either approve or deny the request in the UAC dialog box before you can do anything else on your computer. The dimming of your desktop is referred to as the secure desktop because other programs can't run while it's dimmed.

Windows® 7 introduces two intermediate UAC settings for Protected administrators, in addition to the two from Windows Vista. The first is to notify users only when a program is making the change, so administrators are automatically elevated when they make a change themselves. This is the UAC default setting in Windows 7, and it also makes use of the secure desktop.

The second intermediate setting in Windows 7 is the same as the first except that it doesn't use the secure desktop.

Aa511445_uac_03(en-us,MSDN_10).png


Windows 7 introduces two intermediate UAC settings.

注:关于编写支持用户帐户控制的程序(英文),请参考另外单独的文章。


Design concepts

Goals

A well designed User Account Control experience has the following goals:


Elevation task flow

When a task requires elevation, it has the following steps:

  1. Entry point. Tasks that require immediate elevation when UAC is fully enabled have entry points marked with the UAC shield. In this case, users should expect to see an Elevation UI immediately after clicking such commands—and they should be extra cautious when they see Elevation UI from tasks that don't have a shield.
Aa511445_uac_04(en-us,MSDN_10).png
In this example, the parental control and user accounts control panel items require elevation.
When UAC is partially enabled or turned off completely, the UAC shield is still displayed to indicate that the task involves system-level changes and therefore requires elevation, even if the user might not see Elevation UI. Always displaying the UAC shield for tasks that require elevation keeps the UI simple and predictable.
  1. Elevation. For Protected Administrators, the task requests consent using the Consent UI. For Standard users, the task requests administrator credentials using the Credential UI.
Aa511445_uac_05(en-us,MSDN_10).png
These examples show the Credential UI and the Consent UI.
  1. Separate elevated process. Internally, a new elevated process is created to perform the task.
  2. Revert to least privilege. If necessary, revert to least privilege to complete any steps that don't require elevation.

Note that tasks don't "remember" elevated states. For example, if the user navigates back and forth over an elevation entry point in a wizard, the user must elevate each time.


Usage patterns

User Account Control has several usage patterns (in order of preference):

  1. Work for Standard users. Design the feature for all users by limiting its scope to the current user. By limiting settings to the current user (as opposed to system-wide), you eliminate the need for an Elevation UI entirely, and enable users to complete the task.
Incorrect:
Aa511445_uac_06(en-us,MSDN_10).png
In this example, Windows XP users had to have administrative privileges to view or change the current time zone.
Correct:
Aa511445_uac_07(en-us,MSDN_10).png
In this example, the time zone feature was redesigned in Windows 7 and Windows Vista® to work for all users.
  1. Have separate UI elements for Standard users and administrators. Clearly separate Standard user tasks from administrative tasks. Give all users access to useful read-only information. Clearly identify administrative tasks with the UAC shield.
Aa511445_uac_08(en-us,MSDN_10).png
In this example, the System control panel item shows its state to all users, but changing the system-wide settings requires elevation.
  1. Allow Standard users to attempt task, and to elevate on failure. If Standard users can view the information and are able to make some changes without elevation, allow them to access the UI and have them elevate only if the task fails. This approach is suitable when Standard users have limited access, such as with properties of their own files in Windows Explorer. It is also suitable for settings on Control Panel hybrid hub pages.
Aa511445_uac_09(en-us,MSDN_10).png
In this example, the user attempted to change program file properties but didn't have sufficient privileges. The user can elevate and try again.
  1. Work for administrators only. Use this approach only for administrator features and programs! If a feature is intended only for administrators (and has no navigation paths or useful read-only information for Standard users), you can prompt for administrator credentials at the entry point before showing any UI. Use this approach for lengthy wizards and page flows when all paths require administrative privileges.
If the entire program is for administrators only, mark it to prompt for administrator credentials in order to launch. Windows displays such program icons with the UAC shield overlay.
Aa511445_uac_10(en-us,MSDN_10).png
In this example, the program requires administrative privileges to launch.


Guidelines

UAC shield icon

Aa511445_uac_11(en-us,MSDN_10).png
Command buttons:
Aa511445_uac_12(en-us,MSDN_10).png
A command button that requires immediate elevation.
Command links:
Aa511445_uac_13(en-us,MSDN_10).png
A command link that requires immediate elevation.
Links:
Aa511445_uac_14(en-us,MSDN_10).png
A link that requires immediate elevation.
Menus:
Aa511445_uac_15(en-us,MSDN_10).png
A drop-down menu that requires immediate elevation.


Elevation

Incorrect:
Aa511445_uac_16(en-us,MSDN_10).png
In this example, Standard user settings are incorrectly mixed with administrative settings.
Correct:
Aa511445_uac_17(en-us,MSDN_10).png
In this example, the settings for changing the date and time are in a separate dialog box, available only to administrators. The time zone settings are available to Standard users, and are not mixed with administrative settings.
Aa511445_uac_18(en-us,MSDN_10).png
Aa511445_uac_19(en-us,MSDN_10).png

Object

Circumstance

Where to put UAC shield

When to elevate

Program

Entire program is for administrators only.

Aa511445_uac_20(en-us,MSDN_10).png


UAC shield overlay on program icon.

Display elevation UI at launch.

Command

Entire command is for administrators only.

Aa511445_uac_21(en-us,MSDN_10).png


UAC shield on command button or link.

Display elevation UI when command button or link is clicked, but after any confirmations.

Command

Command displays useful read-only information appropriate for all users, but changes require administrative privileges.

Aa511445_uac_22(en-us,MSDN_10).png


UAC shield on command button or link to make changes.

Display elevation UI when command button is clicked, but after any confirmations.

Command

Standard users can view the information and possibly make some changes without elevation. Allow Standard users to attempt, and to elevate on failure.

Aa511445_uac_23(en-us,MSDN_10).png


Don't show the UAC shield for the command, but show it for the elevation entry point if the command fails.

Display elevation UI when user retries the command.

Task step

All subsequent steps require elevation.

Aa511445_uac_24(en-us,MSDN_10).png


UAC shield on Next button (or equivalent).

Display elevation UI when Next or other commit button is clicked.

Task step

Some branches require elevation.

Aa511445_uac_25(en-us,MSDN_10).png


UAC shield on command links that require elevation.

Display elevation UI when command links with UAC shield are clicked.


Elevation UI

Aa511445_uac_26(en-us,MSDN_10).png
In this example, User Account Control has been turned off so an error message explains that the user must use an administrator account.


Wizards


Text


Documentation

When referring to User Account Control:

In user documentation:

In programming and other technical documentation:

导航
工具箱