ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/security_auto.ycp

/**
 * File:	clients/security_auto.ycp
 * Package:	Security configuration
 * Summary:	Client for autoinstallation
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: security_auto.ycp 20595 2004-12-17 13:51:19Z jsuchome $
 *
 * This is a client for autoinstallation. It takes its arguments,
 * goes through the configuration and return the setting.
 * Does not do any changes to the configuration.
 */

/**
 * @param function to execute
 * @param map/list of security settings
 * @return map edited settings, Summary or boolean on success depending on called function
 * @example map mm = $[ "FAIL_DELAY" : "77" ];
 * @example map ret = WFM::CallFunction ("security_auto", [ "Summary", mm ]);
 */

{

textdomain "security";

y2milestone("----------------------------------------");
y2milestone("Security auto started");

import "Map";
import "Security";

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

any ret = nil;
string func = "";
map param = $[];

/* Check arguments */
if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
    func = (string) WFM::Args(0);
    if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
	param = (map) WFM::Args(1);
}
y2debug("func=%1", func);
y2debug("param=%1", param);

/* Create a  summary*/
if(func == "Summary") {
    list summary	= Security::Summary();
    ret = summary[0]:"";
}
/* Reset configuration */
else if (func == "Reset") {
    Security::Import($[]);
    ret = $[];
}
/* Change configuration (run AutoSequence) */
else if (func == "Change") {
    ret = SecurityAutoSequence();
}
/* Import Data*/
else if(func == "Import") {
    /* Compat */
    if(haskey(param, "encryption"))
	param["passwd_encryption"] =  param["encryption"]:"des";
    ret = Security::Import((map) Map::KeysToUpper((map<string,any>) param));
}
/* Return required packages */
else if (func == "Packages") {
    ret = $[];
}
/* Return actual state */
else if (func == "Export") {
    ret = Map::KeysToLower((map<string,any>) Security::Export());
}
/* Read current state */
else if (func == "Read") {
    import "Progress";
    Progress::off();
    ret = Security::Read();
    Progress::on();
}
/* Write givven settings */
else if (func == "Write") {
    import "Progress";
    Security::write_only = true;
    Progress::off();
    ret = Security::Write();
    Progress::on();
}
else if (func == "SetModified") {
    ret = Security::SetModified ();
}
else if (func == "GetModified") {
    ret = Security::GetModified ();
}
/* Unknown function */
else {
    y2error("Unknown function: %1", func);
    ret = false;
}

y2debug("ret=%1", ret);
y2milestone("Security auto finished");
y2milestone("----------------------------------------");

return ret;

/* EOF */
}

ACC SHELL 2018