2 The header file for user profile manager driver.
4 Copyright (c) 2009 - 2010, 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/UserCredential.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_CREDENTIAL_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 // Guid used in the form browse.
118 extern EFI_GUID mUserProfileManagerGuid
;
121 // The user manager protocol, used in several function.
123 extern EFI_USER_MANAGER_PROTOCOL
*mUserManager
;
126 // The credential providers database in system.
128 extern CREDENTIAL_PROVIDER_INFO
*mProviderInfo
;
131 // The variables used to update identity policy.
133 extern UINT8 mProviderChoice
;
134 extern UINT8 mConncetLogical
;
137 // The variables used to update access policy.
139 extern USER_INFO_ACCESS mAccessInfo
;
142 // The user information used to record all data in UI.
144 extern USER_INFO mUserInfo
;
146 extern USER_PROFILE_MANAGER_CALLBACK_INFO
*mCallbackInfo
;
150 Get string by string id from HII Interface.
153 @param[in] Id String ID to get the string from.
155 @retval CHAR16 * String from ID.
156 @retval NULL If error occurs.
165 Add a new user profile into the user profile database.
174 Display user select form; can select a user to modify.
183 Display user select form, cab select a user to delete.
192 Delete the user specified by UserIndex in user profile database.
194 @param[in] UserIndex The index of user in the user name list to be deleted.
203 Add a username item in form.
205 @param[in] User Points to the user profile whose username is added.
206 @param[in] Index The index of the user in the user name list.
207 @param[in] OpCodeHandle Points to container for dynamic created opcodes.
212 IN EFI_USER_PROFILE_HANDLE User
,
214 IN VOID
*OpCodeHandle
218 Display modify user information form
220 In this form, username, create Date, usage date, usage count, identity policy,
221 and access policy are displayed.
223 @param[in] UserIndex The index of the user in display list to modify.
232 Get the username from user input and update username string in Hii
242 Display the form of modifying user identity policy.
246 ModifyIdentityPolicy (
251 Update the mUserInfo.NewIdentityPolicy and UI when 'add option' is pressed.
255 AddIdentityPolicyItem (
260 Save the identity policy and update UI with it.
262 This funciton will verify the new identity policy, in current implementation,
263 the identity policy can be: T, P & P & P & ..., P | P | P | ...
264 Here, "T" means "True", "P" means "Credential Provider", "&" means "and", "|" means "or".
265 Other identity policies are not supported.
274 Display modify user access policy form
276 In this form, access right, access setu,p and access boot order are dynamically
277 added. Load devicepath and connect devicepath are displayed too.
286 Collect all the access policy data to mUserInfo.AccessPolicy,
287 and save it to user profile.
296 Get current user's access rights.
298 @param[out] AccessRight Points to the buffer used for user's access rights.
300 @retval EFI_SUCCESS Get current user access rights successfully.
301 @retval others Fail to get current user access rights.
306 OUT UINT32
*AccessRight
310 Display the permit load device path in the loadable device path list.
319 Display the forbid load device path list (mAccessInfo.LoadForbid).
328 Display the permit connect device path.
332 DisplayConnectPermit (
337 Display the forbid connect device path list.
341 DisplayConnectForbid (
346 Delete the specified device path by DriverIndex from the forbid device path
347 list (mAccessInfo.LoadForbid).
349 @param[in] DriverIndex The index of driver in a forbidden device path list.
353 DeleteFromForbidLoad (
354 IN UINT16 DriverIndex
358 Add the specified device path by DriverIndex to the forbid device path
359 list (mAccessInfo.LoadForbid).
361 @param[in] DriverIndex The index of driver saved in driver options.
366 IN UINT16 DriverIndex
370 Get user name from the popup windows.
372 @param[in, out] UserNameLen On entry, point to the buffer lengh of UserName.
373 On exit, point to the input user name length.
374 @param[out] UserName The buffer to hold the input user name.
376 @retval EFI_ABORTED It is given up by pressing 'ESC' key.
377 @retval EFI_NOT_READY Not a valid input at all.
378 @retval EFI_SUCCESS Get a user name successfully.
383 IN OUT UINTN
*UserNameLen
,