WebUI: Improve subordinate ids user workflow

- add "Subordinate ID Statistics" page
- add button for generating subid in "Subordinate ids" tab of user details page
- allow to navigate directly to owner details from subordinate id page
- adjust i18n strings

Ticket: https://pagure.io/freeipa/issue/8361
Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Francois Cami <fcami@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Serhii Tsymbaliuk 2021-06-17 13:56:19 +02:00 committed by Rob Crittenden
parent 110940b998
commit 30eceb504a
5 changed files with 121 additions and 20 deletions

View File

@ -602,6 +602,12 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) {
*/
that.facet_group = spec.facet_group || 'settings';
/**
* Indicates if the details facet depends on pkey
* @property {boolean}
*/
that.require_pkey = spec.require_pkey !== undefined ? spec.require_pkey : true;
/**
* Widgets
* @property {IPA.widget_container}
@ -1105,7 +1111,7 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) {
*/
that.refresh = function(on_success, on_error) {
if (!that.get_pkey() && that.entity.redirect_facet) {
if (that.require_pkey && !that.get_pkey() && that.entity.redirect_facet) {
that.redirect();
return;
}

View File

@ -104,7 +104,24 @@ var nav = {};
}
]
},
{ entity: 'subid' }
{
name: 'subid',
label: '@i18n:tabs.subid',
children: [
{
name: 'subid',
entity: 'subid',
facet: 'search',
label: '@i18n:tabs.subid'
},
{
name: 'subid-stats',
entity: 'subid',
facet: 'stats',
label: '@i18n:objects.subid.stats'
}
]
}
]
},
{

View File

@ -31,6 +31,7 @@ return {
},
{
$type: 'details',
disable_facet_tabs: true,
sections: [
{
name: 'details',
@ -38,9 +39,11 @@ return {
'ipauniqueid',
'description',
{
$type: 'link',
name: 'ipaowner',
label: '@i18n:objects.subid.ipaowner',
title: '@mo-param:subid:ipaowner:label'
title: '@mo-param:subid:ipaowner:label',
other_entity: 'user'
},
{
name: 'ipasubgidnumber',
@ -65,6 +68,44 @@ return {
]
}
]
},
{
$type: 'details',
name: 'stats',
label: '@i18n:objects.subid.stats',
refresh_command_name: 'stats',
check_rights: false,
no_update: true,
disable_facet_tabs: true,
disable_breadcrumb: true,
require_pkey: false,
fields: [
{
name: 'assigned_subids',
label: '@i18n:objects.subid.assigned_subids',
read_only: true
},
{
name: 'baseid',
label: '@i18n:objects.subid.baseid',
read_only: true
},
{
name: 'dna_remaining',
label: '@i18n:objects.subid.dna_remaining',
read_only: true
},
{
name: 'rangesize',
label: '@i18n:objects.subid.rangesize',
read_only: true
},
{
name: 'remaining_subids',
label: '@i18n:objects.subid.remaining_subids',
read_only: true
}
]
}
],
adder_dialog: {

View File

@ -464,7 +464,7 @@ return {
},
{
$type: 'subid_generate',
hide_cond: ['preserved-user'],
hide_cond: ['preserved-user', 'self-service-other'],
enable_cond: ['no-subid']
}
],
@ -556,8 +556,35 @@ return {
{
$type: 'association',
name: 'memberof_subid',
columns: [
'ipauniqueid',
'ipasubuidnumber',
'ipasubgidnumber'
],
associator: IPA.serial_associator,
read_only: true
read_only: true,
state: {
evaluators: [
IPA.user.self_service_other_user_evaluator,
IPA.user.preserved_user_evaluator,
IPA.user.has_subid_evaluator
]
},
actions: [
{
$type: 'subid_generate',
name: 'subid_generate',
hide_cond: ['preserved-user', 'self-service-other'],
enable_cond: ['no-subid']
}
],
control_buttons: [
{
name: 'subid_generate',
label: '@i18n:objects.user.auto_subid',
icon: 'fa-plus'
}
]
}
],
standard_association_facets: {
@ -1216,14 +1243,16 @@ IPA.user.subid_generate_action = function(spec) {
var that = IPA.action(spec);
that.execute_action = function(facet) {
var subid_e = reg.entity.get('subid');
var dialog = subid_e.get_dialog('add');
dialog.open();
if (!IPA.is_selfservice) {
var owner = facet.get_pkey();
dialog.get_field('ipaowner').set_value([owner]);
}
var owner = facet.get_pkey();
var command = rpc.command({
entity: 'subid',
method: 'generate'
});
command.set_option('ipaowner', owner);
command.on_success = function(data, text_status, xhr) {
facet.refresh();
};
command.execute();
};
return that;

View File

@ -1364,6 +1364,20 @@ class i18n_messages(Command):
"undel_success": _("${count} user(s) restored"),
"user_categories": _("User categories"),
},
"subid": {
"add": _("Add subid"),
"assigned_subids": _("Assigned subids"),
"baseid": _("Base ID"),
"dna_remaining": _("DNA remaining"),
"ipaowner": _("Owner"),
"ipasubgidcount": _("SubGID range size"),
"ipasubgidnumber": _("SubGID range start"),
"ipasubuidcount": _("SubUID range size"),
"ipasubuidnumber": _("SubUID range start"),
"rangesize": _("Range size"),
"remaining_subids": _("Remaining subids"),
"stats": _("Subordinate ID Statistics"),
},
"sudocmd": {
"add": _("Add sudo command"),
"add_into_sudocmdgroups": _(
@ -1547,13 +1561,6 @@ class i18n_messages(Command):
"Drive to mount a home directory"
),
},
"subid": {
"identity": _("Subordinate user and group id"),
"subuidnumber": _("Subordinate user id"),
"subuidcount": _("Subordinate user id count"),
"subgidnumber": _("Subordinate group id"),
"subgidcount": _("Subordinate group id count"),
},
"trustconfig": {
"options": _("Options"),
},
@ -1942,6 +1949,7 @@ class i18n_messages(Command):
"network_services": _("Network Services"),
"policy": _("Policy"),
"role": _("Role-Based Access Control"),
"subid": _("Subordinate IDs"),
"sudo": _("Sudo"),
"topology": _("Topology"),
"trust": _("Trusts"),