VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/webui/wuiadminuseraccount.py@ 57761

Last change on this file since 57761 was 56295, checked in by vboxsync, 10 years ago

ValidationKit: Updated (C) year.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: wuiadminuseraccount.py 56295 2015-06-09 14:29:55Z vboxsync $
3
4"""
5Test Manager WUI - User accounts.
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2012-2015 Oracle Corporation
11
12This file is part of VirtualBox Open Source Edition (OSE), as
13available from http://www.virtualbox.org. This file is free software;
14you can redistribute it and/or modify it under the terms of the GNU
15General Public License (GPL) as published by the Free Software
16Foundation, in version 2 as it comes in the "COPYING" file of the
17VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19
20The contents of this file may alternatively be used under the terms
21of the Common Development and Distribution License Version 1.0
22(CDDL) only, as it comes in the "COPYING.CDDL" file of the
23VirtualBox OSE distribution, in which case the provisions of the
24CDDL are applicable instead of those of the GPL.
25
26You may elect to license modified versions of this file under the
27terms and conditions of either the GPL or the CDDL or both.
28"""
29__version__ = "$Revision: 56295 $"
30
31# Validation Kit imports.
32from testmanager.webui.wuicontentbase import WuiFormContentBase, WuiListContentBase, WuiTmLink;
33from testmanager.core.useraccount import UserAccountData
34
35
36class WuiUserAccount(WuiFormContentBase):
37 """
38 WUI user account content generator.
39 """
40 def __init__(self, oData, sMode, oDisp):
41 if sMode == WuiFormContentBase.ksMode_Add:
42 sTitle = 'Add User Account';
43 elif sMode == WuiFormContentBase.ksMode_Edit:
44 sTitle = 'Modify User Account';
45 else:
46 assert sMode == WuiFormContentBase.ksMode_Show;
47 sTitle = 'User Account';
48 WuiFormContentBase.__init__(self, oData, sMode, 'User', oDisp, sTitle);
49
50 def _populateForm(self, oForm, oData):
51 oForm.addIntRO( UserAccountData.ksParam_uid, oData.uid, 'User ID');
52 oForm.addTimestampRO(UserAccountData.ksParam_tsEffective, oData.tsEffective, 'Effective Date');
53 oForm.addTimestampRO(UserAccountData.ksParam_tsExpire, oData.tsExpire, 'Effective Date');
54 oForm.addIntRO( UserAccountData.ksParam_uidAuthor, oData.uidAuthor, 'Changed by UID');
55 oForm.addText( UserAccountData.ksParam_sLoginName, oData.sLoginName, 'Login name')
56 oForm.addText( UserAccountData.ksParam_sUsername, oData.sUsername, 'User name')
57 oForm.addText( UserAccountData.ksParam_sFullName, oData.sFullName, 'Full name')
58 oForm.addText( UserAccountData.ksParam_sEmail, oData.sEmail, 'E-mail')
59 if self._sMode != WuiFormContentBase.ksMode_Show:
60 oForm.addSubmit('Add User' if self._sMode == WuiFormContentBase.ksMode_Add else 'Change User');
61 return True;
62
63
64class WuiUserAccountList(WuiListContentBase):
65 """
66 WUI user account list content generator.
67 """
68
69 def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
70 WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
71 sTitle = 'Registered User Accounts', sId = 'users', fnDPrint = fnDPrint, oDisp = oDisp);
72 self._asColumnHeaders = ['User ID', 'Name', 'E-mail', 'Full Name', 'Login Name', 'Actions'];
73 self._asColumnAttribs = ['align="center"', 'align="center"', 'align="center"', 'align="center"', 'align="center"',
74 'align="center"'];
75
76 def _formatListEntry(self, iEntry):
77 from testmanager.webui.wuiadmin import WuiAdmin;
78 oEntry = self._aoEntries[iEntry];
79 return [ oEntry.uid, oEntry.sUsername, oEntry.sEmail, oEntry.sFullName, oEntry.sLoginName,
80 [ WuiTmLink('Modify', WuiAdmin.ksScriptName,
81 { WuiAdmin.ksParamAction: WuiAdmin.ksActionUserEdit,
82 UserAccountData.ksParam_uid: oEntry.uid } ),
83 WuiTmLink('Remove', WuiAdmin.ksScriptName,
84 { WuiAdmin.ksParamAction: WuiAdmin.ksActionUserDelPost,
85 UserAccountData.ksParam_uid: oEntry.uid },
86 sConfirm = 'Are you sure you want to remove user #%d?' % (oEntry.uid,)),
87 ] ];
88
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette