2 The header file for user profile manager driver.
4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __EFI_USER_PROFILE_MANAGER_H__
16 #define __EFI_USER_PROFILE_MANAGER_H__
20 #include <Guid/GlobalVariable.h>
21 #include <Guid/MdeModuleHii.h>
23 #include <Protocol/HiiConfigAccess.h>
24 #include <Protocol/DevicePathToText.h>
25 #include <Protocol/UserCredential2.h>
26 #include <Protocol/UserManager.h>
28 #include <Library/UefiRuntimeServicesTableLib.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/MemoryAllocationLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/DevicePathLib.h>
33 #include <Library/DebugLib.h>
34 #include <Library/UefiLib.h>
35 #include <Library/PrintLib.h>
36 #include <Library/HiiLib.h>
38 #include "UserProfileManagerData.h"
40 #define USER_NAME_LENGTH 17
43 // Credential Provider Information.
47 EFI_USER_CREDENTIAL2_PROTOCOL
*Provider
[1];
48 } CREDENTIAL_PROVIDER_INFO
;
51 // User profile information structure.
57 UINTN AccessPolicyLen
;
58 UINTN IdentityPolicyLen
;
59 UINTN NewIdentityPolicyLen
;
61 UINT8
*IdentityPolicy
;
62 UINT8
*NewIdentityPolicy
;
63 CHAR16 UserName
[USER_NAME_LENGTH
];
64 BOOLEAN CreateDateExist
;
65 BOOLEAN UsageDateExist
;
66 BOOLEAN AccessPolicyModified
;
67 BOOLEAN IdentityPolicyModified
;
68 BOOLEAN NewIdentityPolicyModified
;
72 // User access information structure.
77 UINTN ConnectPermitLen
;
78 UINTN ConnectForbidLen
;
83 UINT32 AccessBootOrder
;
88 #define USER_PROFILE_MANAGER_SIGNATURE SIGNATURE_32 ('U', 'P', 'M', 'S')
92 EFI_HANDLE DriverHandle
;
93 EFI_HII_HANDLE HiiHandle
;
94 EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess
;
95 } USER_PROFILE_MANAGER_CALLBACK_INFO
;
98 // HII specific Vendor Device Path definition.
101 VENDOR_DEVICE_PATH VendorDevicePath
;
102 EFI_DEVICE_PATH_PROTOCOL End
;
103 } HII_VENDOR_DEVICE_PATH
;
106 // This is the generated IFR binary data for each formset defined in VFR.
108 extern UINT8 UserProfileManagerVfrBin
[];
111 // This is the generated String package data for .UNI file.
113 extern UINT8 UserProfileManagerStrings
[];
116 // The user manager protocol, used in several function.
118 extern EFI_USER_MANAGER_PROTOCOL
*mUserManager
;
121 // The credential providers database in system.
123 extern CREDENTIAL_PROVIDER_INFO
*mProviderInfo
;
126 // The variables used to update identity policy.
128 extern UINT8 mProviderChoice
;
129 extern UINT8 mConncetLogical
;
132 // The variables used to update access policy.
134 extern USER_INFO_ACCESS mAccessInfo
;
137 // The user information used to record all data in UI.
139 extern USER_INFO mUserInfo
;
141 extern USER_PROFILE_MANAGER_CALLBACK_INFO
*mCallbackInfo
;
143 extern EFI_USER_PROFILE_HANDLE mModifyUser
;
146 Get string by string id from HII Interface.
149 @param[in] Id String ID to get the string from.
151 @retval CHAR16 * String from ID.
152 @retval NULL If error occurs.
161 Add a new user profile into the user profile database.
170 Display user select form; can select a user to modify.
179 Display user select form, cab select a user to delete.
188 Delete the user specified by UserIndex in user profile database.
190 @param[in] UserIndex The index of user in the user name list to be deleted.
199 Add a username item in form.
201 @param[in] User Points to the user profile whose username is added.
202 @param[in] Index The index of the user in the user name list.
203 @param[in] OpCodeHandle Points to container for dynamic created opcodes.
208 IN EFI_USER_PROFILE_HANDLE User
,
210 IN VOID
*OpCodeHandle
214 Display modify user information form
216 In this form, username, create Date, usage date, usage count, identity policy,
217 and access policy are displayed.
219 @param[in] UserIndex The index of the user in display list to modify.
228 Get the username from user input and update username string in Hii
238 Display the form of modifying user identity policy.
242 ModifyIdentityPolicy (
247 Update the mUserInfo.NewIdentityPolicy and UI when 'add option' is pressed.
251 AddIdentityPolicyItem (
256 Save the identity policy and update UI with it.
258 This funciton will verify the new identity policy, in current implementation,
259 the identity policy can be: T, P & P & P & ..., P | P | P | ...
260 Here, "T" means "True", "P" means "Credential Provider", "&" means "and", "|" means "or".
261 Other identity policies are not supported.
270 Display modify user access policy form
272 In this form, access right, access setu,p and access boot order are dynamically
273 added. Load devicepath and connect devicepath are displayed too.
282 Collect all the access policy data to mUserInfo.AccessPolicy,
283 and save it to user profile.
292 Get current user's access rights.
294 @param[out] AccessRight Points to the buffer used for user's access rights.
296 @retval EFI_SUCCESS Get current user access rights successfully.
297 @retval others Fail to get current user access rights.
302 OUT UINT32
*AccessRight
306 Display the permit load device path in the loadable device path list.
315 Display the forbid load device path list (mAccessInfo.LoadForbid).
324 Display the permit connect device path.
328 DisplayConnectPermit (
333 Display the forbid connect device path list.
337 DisplayConnectForbid (
342 Delete the specified device path by DriverIndex from the forbid device path
343 list (mAccessInfo.LoadForbid).
345 @param[in] DriverIndex The index of driver in a forbidden device path list.
349 DeleteFromForbidLoad (
350 IN UINT16 DriverIndex
354 Add the specified device path by DriverIndex to the forbid device path
355 list (mAccessInfo.LoadForbid).
357 @param[in] DriverIndex The index of driver saved in driver options.
362 IN UINT16 DriverIndex
366 Get user name from the popup windows.
368 @param[in, out] UserNameLen On entry, point to the buffer lengh of UserName.
369 On exit, point to the input user name length.
370 @param[out] UserName The buffer to hold the input user name.
372 @retval EFI_ABORTED It is given up by pressing 'ESC' key.
373 @retval EFI_NOT_READY Not a valid input at all.
374 @retval EFI_SUCCESS Get a user name successfully.
379 IN OUT UINTN
*UserNameLen
,
384 Find the specified info in User profile by the InfoType.
386 @param[in] User Handle of the user whose information will be searched.
387 @param[in] InfoType The user information type to find.
388 @param[out] UserInfo Points to user information handle found.
390 @retval EFI_SUCCESS Find the user information successfully.
391 @retval Others Fail to find the user information.
396 IN EFI_USER_PROFILE_HANDLE User
,
398 OUT EFI_USER_INFO_HANDLE
*UserInfo
402 Convert the identity policy to a unicode string and update the Hii database
403 IpStringId string with it.
405 @param[in] Ip Points to identity policy.
406 @param[in] IpLen The identity policy length.
407 @param[in] IpStringId String ID in the HII database to be replaced.
411 ResolveIdentityPolicy (
414 IN EFI_STRING_ID IpStringId
418 Expand access policy memory size.
420 @param[in] ValidLen The valid access policy length.
421 @param[in] ExpandLen The length that is needed to expand.
431 Delete User's credental from all the providers that exist in User's identity policy.
433 @param[in] IdentityPolicy Point to User's identity policy.
434 @param[in] IdentityPolicyLen The length of the identity policy.
435 @param[in] User Points to user profile.
439 DeleteCredentialFromProviders (
440 IN UINT8
*IdentityPolicy
,
441 IN UINTN IdentityPolicyLen
,
442 IN EFI_USER_PROFILE_HANDLE User