/** @file
The functions to modify a user profile.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "UserProfileManager.h"
/**
Display user select form, cab select a user to modify.
**/
)
{
//
// Initialize the container for dynamic opcodes.
//
//
// Create Hii Extend Label OpCode.
//
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
//
// Add each user can be modified.
//
Index = 1;
while (TRUE) {
break;
}
}
}
Index++;
}
&gUserProfileManagerGuid, // Formset GUID
FORMID_MODIFY_USER, // Form ID
StartOpCodeHandle, // Label for where to insert opcodes
EndOpCodeHandle // Replace data
);
}
/**
Get all the user info from mModifyUser in the user manager, and save on the
global variable.
**/
)
{
//
// Init variable to default value.
//
mProviderChoice = 0;
mConncetLogical = 0;
mUserInfo.UsageCount = 0;
mUserInfo.AccessPolicyLen = 0;
}
}
//
// Allocate user information memory.
//
return ;
}
//
// Get each user information.
//
while (TRUE) {
break;
}
//
// Get information.
//
Info,
);
if (Status == EFI_BUFFER_TOO_SMALL) {
return ;
}
Info,
);
}
if (Status == EFI_SUCCESS) {
//
// Deal with each information according to informaiton type.
//
break;
break;
break;
break;
break;
}
break;
break;
}
break;
default:
break;
}
}
}
}
/**
Convert the Date to a string, and update the Hii database DateID string with it.
@param[in] Date Points to the date to be converted.
@param[in] DateId String ID in the HII database to be replaced.
**/
)
{
//
// Convert date to string.
//
DateBufLen = 64;
return ;
}
Str,
L"%4d-%2d-%2d ",
);
//
// Convert time to string.
//
L"%2d:%2d:%2d",
);
}
/**
Convert the CountVal to a string, and update the Hii database CountId string
with it.
@param[in] CountVal The hex value to convert.
@param[in] CountId String ID in the HII database to be replaced.
**/
)
{
}
/**
Concatenates one Null-terminated Unicode string to another Null-terminated
Unicode string.
@param[in, out] Source1 On entry, point to a Null-terminated Unicode string.
On exit, point to a new concatenated Unicode string
@param[in] Source2 Pointer to a Null-terminated Unicode string.
**/
AddStr (
)
{
} else {
}
} else {
}
}
/**
Convert the identity policy to a unicode string and update the Hii database
IpStringId string with it.
@param[in] Ip Points to identity policy.
@param[in] IpLen The identity policy length.
@param[in] IpStringId String ID in the HII database to be replaced.
**/
)
{
//
// Resolve each policy.
//
ChkLen = 0;
break;
break;
break;
break;
break;
);
}
break;
}
}
break;
);
}
break;
}
}
break;
}
}
}
}
/**
Display modify user information form.
This form displays, username, create Date, usage date, usage count, identity policy,
and access policy.
@param[in] UserIndex The index of the user in display list to modify.
**/
)
{
//
// Initialize the container for dynamic opcodes.
//
//
// Create Hii Extend Label OpCode.
//
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
//
// Find the user profile to be modified.
//
mModifyUser = NULL;
return ;
}
while (UserIndex > 1) {
return ;
}
UserIndex--;
}
//
// Get user profile information.
//
GetAllUserInfo ();
//
// Update user name.
);
//
// Update create date.
//
if (mUserInfo.CreateDateExist) {
} else {
L"",
);
}
//
// Add usage date.
//
if (mUserInfo.UsageDateExist) {
} else {
L"",
);
}
//
// Add usage count.
//
//
// Add identity policy.
//
if (mModifyUser == CurrentUser) {
);
StartOpCodeHandle, // Container for opcodes
FORMID_MODIFY_IP, // Target Form ID
EFI_IFR_FLAG_CALLBACK, // Question flag
);
}
//
// Add access policy.
//
}
StartOpCodeHandle, // Container for opcodes
FORMID_MODIFY_AP, // Target Form ID
EFI_IFR_FLAG_CALLBACK, // Question flag
);
}
&gUserProfileManagerGuid, // Formset GUID
FORMID_USER_INFO, // Form ID
StartOpCodeHandle, // Label
EndOpCodeHandle // Replace data
);
}
/**
Get all the access policy info from current user info, and save in the global
variable.
**/
)
{
//
// Set default value
//
mAccessInfo.LoadPermitLen = 0;
mAccessInfo.LoadForbidLen = 0;
//
// Get each user access policy.
//
OffSet = 0;
break;
break;
break;
}
break;
break;
}
}
break;
}
}
break;
}
}
break;
}
}
break;
}
}
}
/**
Find the specified info in User profile by the InfoType.
@param[in] User Handle of the user whose information will be searched.
@param[in] InfoType The user information type to find.
@param[out] UserInfo Points to user information handle found.
@retval EFI_SUCCESS Find the user information successfully.
@retval Others Fail to find the user information.
**/
)
{
return EFI_INVALID_PARAMETER;
}
//
// Allocate user information memory.
//
return EFI_OUT_OF_RESOURCES;
}
//
// Get each user information.
//
while (TRUE) {
break;
}
//
// Get information.
//
User,
*UserInfo,
Info,
);
if (Status == EFI_BUFFER_TOO_SMALL) {
return EFI_OUT_OF_RESOURCES;
}
User,
*UserInfo,
Info,
);
}
if (Status == EFI_SUCCESS) {
break;
}
}
}
return Status;
}
/**
Display modify user access policy form.
In this form, access right, access setup and access boot order are dynamically
added. Load devicepath and connect devicepath are displayed too.
**/
)
{
//
// Initialize the container for dynamic opcodes.
//
//
// Create Hii Extend Label OpCode.
//
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
//
// Resolve access policy information.
//
//
// Add access right one-of-code.
//
0,
);
0,
);
0,
);
);
StartOpCodeHandle, // Container for dynamic created opcodes
0, // VarStore ID
0, // Offset in Buffer Storage
EFI_IFR_FLAG_CALLBACK, // Question flag
EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value
OptionsOpCodeHandle, // Option Opcode list
DefaultOpCodeHandle // Default Opcode
);
//
// Add setup type one-of-code.
//
0,
);
0,
);
0,
);
);
StartOpCodeHandle, // Container for dynamic created opcodes
0, // VarStore ID
0, // Offset in Buffer Storage
EFI_IFR_FLAG_CALLBACK, // Question flag
EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value
OptionsOpCodeHandle, // Option Opcode list
DefaultOpCodeHandle // Default Opcode
);
//
// Add boot order one-of-code.
//
0,
);
0,
);
0,
);
0,
);
);
StartOpCodeHandle, // Container for dynamic created opcodes
0, // VarStore ID
0, // Offset in Buffer Storage
EFI_IFR_FLAG_CALLBACK, // Question flag
EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value
OptionsOpCodeHandle, // Option Opcode list
DefaultOpCodeHandle // Default Opcode
);
//
// Update Form.
//
&gUserProfileManagerGuid, // Formset GUID
FORMID_MODIFY_AP, // Form ID
StartOpCodeHandle, // Label for where to insert opcodes
EndOpCodeHandle // Replace data
);
}
/**
Expand access policy memory size.
@param[in] ValidLen The valid access policy length.
@param[in] ExpandLen The length that is needed to expand.
**/
)
{
//
// Expand memory.
//
}
}
/**
Get the username from user input, and update username string in the Hii
database with it.
**/
)
{
//
// Get the new user name.
//
if (Status != EFI_ABORTED) {
&Key,
L"Failed To Get User Name.",
L"",
L"Please Press Any Key to Continue ...",
);
}
return ;
}
//
// Check whether the username had been used or not.
//
return ;
}
&TempUser,
NULL,
Info,
);
&Key,
L"The User Name Had Been Used.",
L"",
L"Please Use Other User Name",
);
return ;
}
//
// Update username display in the form.
//
);
//
// Save the user name.
//
&UserInfo,
Info,
);
}
}
/**
Display the form of the modifying user identity policy.
**/
)
{
//
// Initialize the container for dynamic opcodes.
//
//
// Create Hii Extend Label OpCode.
//
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
//
// Add credential providers
//.
if (mProviderInfo->Count > 0) {
//
// Add credential provider Option OpCode.
//
);
if (ProvID == 0) {
return ;
}
0,
);
}
StartOpCodeHandle, // Container for dynamic created opcodes
0, // VarStore ID
0, // Offset in Buffer Storage
EFI_IFR_FLAG_CALLBACK, // Question flag
EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value
OptionsOpCodeHandle, // Option Opcode list
NULL // Default Opcode is NULl
);
}
//
// Add logical connector Option OpCode.
//
0,
0
);
0,
1
);
StartOpCodeHandle, // Container for dynamic created opcodes
0, // VarStore ID
0, // Offset in Buffer Storage
EFI_IFR_FLAG_CALLBACK, // Question flag
EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value
OptionsOpCodeHandle, // Option Opcode list
NULL // Default Opcode is NULl
);
//
// Update identity policy in the form.
//
);
}
mProviderChoice = 0;
mConncetLogical = 0;
&gUserProfileManagerGuid, // Formset GUID
FORMID_MODIFY_IP, // Form ID
StartOpCodeHandle, // Label for where to insert opcodes
EndOpCodeHandle // Replace data
);
}
/**
Get current user's access right.
@param[out] AccessRight Points to the buffer used for user's access right.
@retval EFI_SUCCESS Get current user access right successfully.
@retval others Fail to get current user access right.
**/
)
{
//
// Allocate user information memory.
//
return EFI_OUT_OF_RESOURCES;
}
//
// Get user access information.
//
while (TRUE) {
//
// Get next user information.
//
break;
}
Info,
);
if (Status == EFI_BUFFER_TOO_SMALL) {
return EFI_OUT_OF_RESOURCES;
}
Info,
);
}
break;
}
//
// Check user information.
//
CheckLen = 0;
//
// Get specified access information.
//
) {
return EFI_SUCCESS;
}
}
}
}
return EFI_NOT_FOUND;
}