ACC SHELL

Path : /usr/share/YaST2/include/security/
File Upload :
Current File : //usr/share/YaST2/include/security/users.ycp

/**
 * File:	include/security/users.ycp
 * Package:	Security configuration
 * Summary:	Users dialogs definitions
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: users.ycp 51199 2008-09-16 17:01:23Z lslezak $
 */

{

textdomain "security";

import "Label";
import "Popup";
import "Wizard";

include "security/helps.ycp";
include "security/routines.ycp";

/**
 * Adduser dialog
 * @return dialog result
 */
define any AdduserDialog() ``{

    /* Adduser dialog caption */
    string caption = _("User Addition");
    string help = HELPS["adduser"]:"";

    /* Adduser dialog contents */
    term contents = `VBox(
	VSeparator(),
	/* Frame label */
	XFrame(1.8,0.5,_("User ID Limitations"),`HBox(
	settings2widget("UID_MIN"),
	`HSpacing(1.5),
	settings2widget("UID_MAX")
	)),
	`VSpacing(0.7),
	/* Frame label */
	XFrame(1.8,0.5,_("Group ID Limitations"),`HBox(
	settings2widget("GID_MIN"),
	`HSpacing(1.5),
	settings2widget("GID_MAX")
	)),
	`VSpacing(1.7)
    );

    contents = `HVCenter(`HVSquash(`HBox(`HSpacing(5),`VBox(`VSpacing(2),`ReplacePoint(`id(`rp_main),contents),`VSpacing(2)),`HSpacing(5))));
    Wizard::SetContentsButtons(caption, contents, help,
	    Label::BackButton(), Label::OKButton());

    Wizard::HideBackButton();
    Wizard::SetAbortButton( `abort, Label::CancelButton() );

    // select the dialog in the tree navigation
    Wizard::SelectTreeItem("users");

    any ret = nil;
    while(true) {
	ret = UI::UserInput();

	/* abort? */
	if(ret == `abort || ret == `cancel) {
	    if(ReallyAbort()) break;
	    else continue;
	}
	/* back */
	else if(ret == `back) {
	    break;
	}
	/* next */
	else if(ret == `next || contains(tree_dialogs, ret)) {
	    // the current item has been selected, do not change to the same dialog
	    if (ret == "users")
	    {
		// preselect the item if it has been unselected
		if (Wizard::QueryTreeItem() != "users")
		{
		    Wizard::SelectTreeItem("users");
		}

		continue;
	    }

	    if(checkMinMax("UID_MIN","UID_MAX") != true) {
		/* Popup text */
		Popup::Error(_("The minimum user ID cannot be larger than the maximum."));
		continue;
	    }
	    if(checkMinMax("GID_MIN","GID_MAX") != true) {
		/* Popup text */
		Popup::Error(_("The minimum group ID cannot be larger than the
maximum."));
		continue;
	    }
	    break;
	}
	else {
	    y2error("Unexpected return code: %1", ret);
	    continue;
	}
    }

    if(ret == `next || contains(tree_dialogs, ret)) {
	widget2settings("GID_MIN");
	widget2settings("GID_MAX");
	widget2settings("UID_MIN");
	widget2settings("UID_MAX");
    }

    return ret;
}

/* EOF */
}

ACC SHELL 2018