ACC SHELL
/**
* File:
* users_plugin_ldap_all.ycp
*
* Package:
* Configuration of Users
*
* Summary:
* This is part GUI of UsersPluginSambaGroups - plugin for editing all LDAP
* attributes for Samba groups.
*
* $Id: users_plugin_samba_groups.ycp 49671 2008-08-05 08:39:17Z locilka $
*/
{
textdomain "samba-users"; // use own textdomain for new plugins
import "Label";
import "Popup";
import "Report";
import "Wizard";
import "Ldap";
import "LdapPopup";
import "Users";
import "UsersLDAP";
import "UsersPluginSambaGroups"; // plugin module
any ret = nil;
string func = "";
map<string,any> config = $[];
map<string,any> data = $[];
/* 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))
config = (map<string,any>)WFM::Args(1);
if(size(WFM::Args()) > 2 && is(WFM::Args(2), map))
data = (map<string,any>)WFM::Args(2);
}
y2milestone("----------------------------------------");
y2milestone("users plugin started: Samba");
y2debug ("func=%1", func);
y2debug ("config=%1", config);
y2debug ("data=%1", data);
if (func == "Summary") {
ret = UsersPluginSambaGroups::Summary (config, $[]);
}
else if (func == "Name") {
ret = UsersPluginSambaGroups::Name (config, $[]);
}
else if (func == "Dialog") {
// define the dialog for this plugin and return it's contents
string caption = UsersPluginSambaGroups::Name (config, $[]);
if (data["what"]:"" == "edit_group" ) {
data = UsersPluginSambaGroups::EditBefore (config, data);
} else if ( data["what"]:"" == "add_group" ) {
data = UsersPluginSambaGroups::AddBefore (config, data);
}
string help_text =
# help text
_("<p>This plugin can be used to enable an LDAP group to be available for Samba.
The only setting that you can edit here is the <b>Samba Group Name</b> Attribute,
which is the Name of the Group as it should appear for Samba-Clients. All other
settings are computed automatically. If you leave the <b>Samba Group Name</b> empty,
the same name as configured in the Global Settings of this Group will be used.</p>");
term contents = `Empty();
contents = `HBox(`HSpacing (1.5), `VBox(
`VSpacing(0.5),
`TextEntry(`id(`smbName), _("Samba Group Name"), data["displayName"]:"" ),
`VSpacing (0.5)
),
`HSpacing (1.5)
);
Wizard::CreateDialog ();
Wizard::SetDesktopIcon("users");
// dialog caption
Wizard::SetContentsButtons(_("Edit Samba Attributes"),
contents, help_text, Label::BackButton(), Label::NextButton());
Wizard::HideAbortButton ();
ret = `next;
repeat
{
ret = UI::UserInput();
if ( ret == `next )
{
string err = UsersPluginSambaGroups::Check ( config, data);
data["displayName"] = UI::QueryWidget(`id(`smbName), `Value );
if (err != "")
{
Report::Error (err);
ret = `notnext;
continue;
}
// if this plugin wasn't in default set, we must save its name
if (!contains (data["plugins"]:[], "UsersPluginSambaGroups"))
{
data["plugins"] = add (data["plugins"]:[],
"UsersPluginSambaGroups");
}
if (data["what"]:"" == "edit_group")
{
Users::EditGroup (data);
}
else if (data["what"]:"" == "add_group")
{
Users::AddGroup (data);
}
}
} until (is(ret,symbol) &&
contains ([`next, `abort, `back, `cancel], (symbol) ret));
Wizard::CloseDialog ();
}
/* unknown function */
else {
y2error("unknown function: %1", func);
ret = false;
}
y2debug ("ret=%1", ret);
y2milestone("groups plugin finished");
y2milestone("----------------------------------------");
return ret;
}
ACC SHELL 2018