3,641 bytes added
, 17:39, 3 January 2014
=== NAME ===
esmith::FormMagick::Panels::groups - useful panel functions<br />
In a root terminal you can do the command below if you want to display the up-to-date content
perldoc esmith::FormMagick::Panels::groups
=== SYNOPSIS ===
use esmith::FormMagick::Panels::groups;
my $panel = esmith::FormMagick::Panel::groups->new();
$panel->display();
=== DESCRIPTION ===
==== new(); ====
Exactly as for esmith::FormMagick
=== ACCESSORS ===
==== get_cgi_param FM FIELD ====
Returns the named CGI parameter as a string
==== get_accounts_prop ITEM PROP ====
A simple accessor for esmith::AccountsDB::Record::prop
==== get_description ====
Get the Description for the group named in the CGI argument "GroupName"
=== ACTION ===
==== show_initial FM ====
Show the "start" page for this panel
==== create_group FM ====
Create a group
==== modify_group FM ====
Modify a group’s description and membership roster
==== delete_group FM ====
Delete a group and move all of its ibays to the ’admin’ group.
=== VALIDATION ===
==== validate_is_group FM GROUP ====
returns OK if GROUP is a current group. otherwisee returns "NOT_A_GROUP"
==== validate_group_naming_conflict FM GROUPNAME ====
Returns "OK" if this group’s name doesn’t conflict with anything Returns "PSEUDONYM_CONFLICT" if this name conflicts with a pseudonym Returns "NAME_CONFLICT" if this group name conflicts with anything else ok (undef, ’need testing for validate_naming_Conflicts’);
sub validate_group_naming_conflict {
my $fm = shift;
my $groupName = shift;
my $account = $accounts->get($groupName);
my $type;
if (defined $account)
{
$type = $account->prop(’type’);
}
elsif (defined getpwnam($groupName) ││ defined getgrnam($groupName))
{
$type = "system";
}
else
{
return(’OK’);
}
return $fm->localise(’ACCOUNT_CONFLICT’,
{ group => $groupName,
type => $type,
});
}
==== validate_group FM groupname ====
Returns OK if the group name contains only valid characters Returns GROUP_NAMING otherwise
ok(validate_group(’’,’foo’) eq ’OK’, ’foo is a valid group); ok(vali-
date_group(’’,’f&oo’) eq ’GROUP_CONTAINS_INVALD’, ’f&oo is not a valid
group);
==== validate_group_length FM GROUPNAME ====
returns ’OK’ if the group name is shorter than the maximum group name length returns ’GROUP_TOO_LONG’ otherwise
==== validate_group_has_members FM MEMBERS ====
Validates that the cgi parameter MEMBERS is an array with at least one entry Returns OK if true. Otherwise, returns NO_MEMBERS
=== UTILITY FUNCTIONS ===
==== print_group_members FM ACCT ====
Takes an FM object and the name of a group. Prints out an unordered list of the group’s members.
==== build_cgi_params() ====
Builds a CGI query string, using various sensible defaults and esmith::FormMagick’s props_to_query_string() method.
==== genUsers MEMBERS ====
Takes a comma delimited list of users and returns a string of html checkboxes for all system users with the members of the group in $fm->{cgi}->parm(’groupName’)checked.
==== clear_params ====
This method clears-out the parameters used in form submission so that they are not inadvertently picked-up where they should not be.
[[Category:Developer]]
[[Category:SME Server Development Framework]]
[[Category:Development Tools]]