/** @file
The functions to delete 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"
/**
Get the username from the specified user.
@param[in] User Handle of a user profile.
@retval EFI_STRING_ID The String Id of the user's username.
**/
)
{
//
// Allocate user information memory.
//
//
// Get user name information.
//
while (TRUE) {
//
// Get next user information.
//
User,
);
break;
}
User,
Info,
);
if (Status == EFI_BUFFER_TOO_SMALL) {
User,
Info,
);
}
//
// Check user information.
//
if (Status == EFI_SUCCESS) {
}
UserId = HiiSetString (
0,
);
if (UserId != 0) {
return UserId;
}
}
}
}
return 0;
}
/**
Add a username item in form.
@param[in] User Points to the user profile whose username is added.
@param[in] Index The index of the user in the user name list
@param[in] OpCodeHandle Points to container for dynamic created opcodes.
**/
)
{
//
// Get user name
//
if (NameId == 0) {
return ;
}
//
// Create user name option.
//
switch (Index & KEY_FIRST_FORM_MASK) {
case KEY_MODIFY_USER:
OpCodeHandle, // Container for dynamic created opcodes
FORMID_USER_INFO, // Target Form ID
NameId, // Prompt text
EFI_IFR_FLAG_CALLBACK, // Question flag
Index // Question ID
);
break;
case KEY_DEL_USER:
OpCodeHandle, // Container for dynamic created opcodes
Index, // Question ID
NameId, // Prompt text
EFI_IFR_FLAG_CALLBACK, // Question flag
0 // Action String ID
);
break;
default:
break;
}
}
/**
Delete the user specified by UserIndex in user profile database.
@param[in] UserIndex The index of user in the user name list
to be deleted.
**/
)
{
//
// Find specified user profile and delete it.
//
goto Done;
}
while (UserIndex > 1) {
goto Done;
}
UserIndex--;
}
if (UserIndex == 1) {
//
// Get the identification policy.
//
goto Done;
}
InfoSize = 0;
if (Status == EFI_BUFFER_TOO_SMALL) {
goto Done;
}
}
//
// Delete the user on the credential providers by its identification policy.
//
goto Done;
}
&Key,
L"Delete User Succeed!",
L"",
L"Please Press Any Key to Continue ...",
);
return ;
}
Done:
&Key,
L"Delete User Failed!",
L"",
L"Please Press Any Key to Continue ...",
);
}
/**
Display user select form, cab select a user to delete.
**/
)
{
//
// 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 deleted.
//
Index = 1;
while (TRUE) {
break;
}
if (User != CurrentUser) {
User,
);
}
Index++;
}
&gUserProfileManagerGuid, // Formset GUID
FORMID_DEL_USER, // Form ID
StartOpCodeHandle, // Label for where to insert opcodes
EndOpCodeHandle // Replace data
);
}