CipUX-Task-3.4.0.7000755001750001750 011337035217 14352 5ustar00ckuelkerckuelker000000000000Changes000444001750001750 1302611337035217 15745 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7Revision history for CipUX-Task 3.4.0.7 2010-02-17T19:36:12 - changes: * fix useless require of the object parameter in tasks *_search_all_*, rename then to odinary scope retrieve_all * tighten licence specification to make META.yml happy * improve licence text * cipux_task_client uses correct run parameter * add support for RLP class promotion concept this will add the new tasks: - cipux_task_retrieve_all_uidnumber - cipux_task_retrieve_all_gidnumber - cipux_task_retrieve_all_primary_group_gidnumber - cipux_task_change_${ROLE}_account_homedir - cipux_task_change_${ROLE}_account_uidnumber - cipux_task_change_${ROLE}_account_gidnumber - cipux_task_change_${ROLE}_account_primary_group_gidnumber - contributor: Christian Kuelker - version created by: Christian Kuelker 3.4.0.6 2009-10-11T15:11:49 - changes: * disable LDAP node entity untill needed * replace on_command_line with interactive * add ltarget to task header (helps listings) * new task cipux_task_optain_cat_module_task is needed for deregisering CAT modules with cipux_cat_web_module client * updated leaktrace test to match Etch requirements - contributor: Christian Kuelker - version created by: Christian Kuelker 3.4.0.5 2009-09-03T14:54:52 - changes: * set leaktrace accteptable count to < 51 - contributor: Christian Kuelker - version created by: Christian Kuelker 3.4.0.4 2009-09-03T14:23:43 - changes: * remove leaktrace test, which to not use tmp cache dir * regarding a suggestion from Ulich P. Klein renameing task cipux_task_change_own_password_on_command_line to cipux_task_change_own_password_interactive * regarding a suggestion from Ulrich P. Klein renaming task cipux_task_change_user_account_password_on_command_line to cipux_task_change_user_account_password_interactive - contributor: Christian Kuelker - version created by: Christian Kuelker 3.4.0.3 2009-09-03T11:32:44 - changes: * add return value to exec_task_dog * modify refcount test to use tmp cache dir * change leaktrace test to accept < 38 memory leaks with or without using temporary cache dir * add tmp cache dir support for CipUX::Task - contributor: Christian Kuelker - version created by: Christian Kuelker 3.4.0.2 2009-04-23T19:25:00 - changes: * fix wrong version * add new task cipux_task_change_own_password_on_command_line - version created by: Christian Kuelker 3.4.0.1 2009-04-20T00:54:43 - changes: * fix ambiguity in cipux_task_sum parameter call * remove indirect build dependency Module::Build * add leaktrace.t test - version created by: Christian Kuelker 3.4.0.0 2009-03-25T16:37:16 - version created by: Christian Kuelker 3.002016 2007-04-02T10:45:36 - version created by: Christian Kuelker 3.002015 2006-12-29T13:52:31 - version created by: Christian Kuelker 3.002013 2006-12-29T03:20:12 - version created by: Christian Kuelker 3.002012 2006-12-27T18:56:37 - version created by: Christian Kuelker 3.002015 2006-07-25T12:24:25 - version created by: Christian Kuelker 3.002010 2006-06-08T20:28:29 - version created by: Christian Kuelker 3.002009 2005-09-11T00:46:40 - version created by: Christian Kuelker 3.002008 2005-08-26T12:38:35 - version created by: Christian Kuelker 3.002007 2005-08-25T23:10:12 - version created by: Christian Kuelker 3.002006 2005-08-23T22:01:22 - version created by: Christian Kuelker 3.002005 2005-08-19T14:56:30 - version created by: Christian Kuelker 3.002004 2005-08-19T13:24:11 - version created by: Christian Kuelker 3.002003 2005-08-19T01:05:28 - version created by: Christian Kuelker 3.002002 2005-08-18T14:59:17 - version created by: Christian Kuelker 3.002001 2005-08-16T23:29:25 - version created by: Christian Kuelker 3.002000 Sat Jun 11 19:05:10 2005 - original version; created by h2xs 1.23 with options -v 3.002000 -XA -n CiBot MANIFEST000444001750001750 51111337035217 15536 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7bin/cipux_task_client Build.PL Changes doc/example/cipux_cleanup_class_shares.sh lib/CipUX/Task.pm lib/CipUX/Task/Client.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP META.yml README t/00.load.t t/leaktrace.t t/perlcritic.t t/perlcritic_cpan.t t/perlcriticrc t/pod.t t/refcount.t usr/share/cipux/etc/cipux-task.perl MANIFEST.SKIP000444001750001750 22711337035217 16307 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7-stamp$ \.orig$ \.bak$ \.swp$ \.svn _build blib Build$ \.ptkdb$ .deb$ .build$ .changes$ .upload$ .asc$ .dsc$ .tar.gz$ .cvsignore debian/files$ \..*\~$ META.yml000444001750001750 205211337035217 15700 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7--- name: CipUX-Task version: v3.4.0.7 author: - 'Christian Kuelker ' abstract: CipUX Task layer license: gpl2 resources: homepage: http://www.cipux.org license: http://opensource.org/licenses/gpl-2.0.php build_requires: File::Spec: 0 Module::Build::CipUX: v0.3.0 Test::LeakTrace: 0 Test::More: 0 Test::Refcount: 0 requires: Carp: 0 CipUX: v3.4.0.0 CipUX::Object: v3.4.0.0 CipUX::Storage: v3.4.0.0 Class::Std: v0.0.9 Data::Dumper: 0 English: 0 File::Copy: 0 Getopt::Long: 0 Log::Log4perl: 0 Pod::Usage: 0 Readonly: 0 Scalar::Util: 0 Sys::Hostname: 0 Term::ReadKey: 0 version: 0 recommends: Test::Perl::Critic: 0 Test::Pod: 1.14 Test::Pod::Coverage: 1.04 configure_requires: Module::Build: 0.35 provides: CipUX::Task: file: lib/CipUX/Task.pm version: v3.4.0.7 CipUX::Task::Client: file: lib/CipUX/Task/Client.pm version: v3.4.0.7 generated_by: Module::Build version 0.35 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 Makefile.PL000444001750001750 17111337035217 16361 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7use Module::Build::Compat; Module::Build::Compat->run_build_pl(args => \@ARGV); Module::Build::Compat->write_makefile(); Build.PL000444001750001750 300111337035217 15716 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7use warnings; use strict; use Module::Build::CipUX; use version; our $VERSION = qv('3.4.0.7'); my $builder = Module::Build::CipUX->new( module_name => 'CipUX::Task', license => 'gpl2', dist_author => 'Christian Kuelker ', dist_version => $VERSION, dist_abstract => 'CipUX Task layer', # create_makefile_pl => 'traditional', # create_readme => 1, installdirs => 'vendor', meta_merge => { resources => { homepage => q(http://www.cipux.org), }, }, recommends => { 'Test::Perl::Critic' => 0, 'Test::Pod' => '1.14', 'Test::Pod::Coverage' => '1.04', }, build_requires => { 'File::Spec' => 0, 'Module::Build::CipUX' => '0.3.0', 'Test::More' => 0, 'Test::Refcount' => 0, 'Test::LeakTrace' => 0, }, requires => { 'Carp' => 0, 'CipUX' => '3.4.0.0', 'CipUX::Object' => '3.4.0.0', 'CipUX::Storage' => '3.4.0.0', 'Class::Std' => '0.0.9', 'Data::Dumper' => 0, 'English' => 0, 'File::Copy' => 0, 'Getopt::Long' => 0, 'Log::Log4perl' => 0, 'Pod::Usage' => 0, 'Readonly' => 0, 'Scalar::Util' => 0, 'Sys::Hostname' => 0, 'Term::ReadKey' => 0, 'version' => 0, }, add_to_cleanup => ['CipUX-Task-*'], ); $builder->create_build_script(); README000444001750001750 122511337035217 15310 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7CipUX-Task version 3.4.0.7 CipUX Task commands for using on command line as for the XML-RPC server. INSTALLATION To install this module, preferably run the following commands: perl Build.PL ./Build ./Build test ./Build install DEPENDENCIES Carp CipUX CipUX::Object CipUX::Storage Class::Std Data::Dumper English File::Copy Getopt::Long Log::Log4perl Pod::Usage Readonly Scalar::Util Sys::Hostname Term::ReadKey version COPYRIGHT AND LICENCE Copyright (C) 1999 - 2009, Christian Kuelker This library is licensed under the GNU GPL - GNU General Public License version 2 or later. usr000755001750001750 011337035217 15104 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7share000755001750001750 011337035217 16206 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/usrcipux000755001750001750 011337035217 17336 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/usr/shareetc000755001750001750 011337035217 20111 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/usr/share/cipuxcipux-task.perl000444001750001750 17713011337035217 23273 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/usr/share/cipux/etc# +==========================================================================+ # || /usr/share/cipux/etc/cipux-task.perl || # || || # || Configuration file for the CipUX Task Library. || # || Default boot strap configuration for CipUX tasks. || # || || # || Copyright (C) 2007 - 2010 by Christian Kuelker || # || || # || License: GNU GPL - GNU general public license - version 2 || # || or (at your opinion) any later version. || # +==========================================================================+ # do NOT change the ordering of the configuration sections # +=========================================================================+ # || CipUX Task Library API Section || # +=========================================================================+ # +-------------------------------------------------------------------------+ # | basic user | # +-------------------------------------------------------------------------+ # user account modalities: # $cfg_task_api_hr my $cfg = { 'task_api' => { # +-----------------------------------------------------------------+ # | ldap orga node | # +-----------------------------------------------------------------+ # disable LDAP node entity untill needed #'cipux_task_create_ldap_orga_node' => { # 'desc' => 'Create LDAP organizational node.', # 'object' => ['cipux_ldap_orga_node_object'], # 'action' => 'create_object_action', # 'overwrite' => { # 'cipux_ldap_orga_node' => # { 'cipuxRemark' => 'CipUX task layer', }, # }, #}, #'cipux_task_destroy_ldap_orga_node' => { # 'desc' => 'Destroy LDAP organizational node.', # 'object' => [qw(cipux_ldap_orga_node_object)], # 'action' => 'destroy_object_action', #}, ## #'cipux_task_list_ldap_orga_nodes' => { # 'desc' => 'List all LDAP organizational node.', # 'object' => [qw(cipux_ldap_orga_node_object)], # 'action' => 'list_object_action', # 'filter' => { # 'cipux_ldap_orga_node_object' => # { 'objectClass' => 'cipuxLdapOrgaNode', }, # }, # 'ltarget' => 'ou', # TODO verify #}, # +-----------------------------------------------------------------+ # | role | # +-----------------------------------------------------------------+ 'cipux_task_create_role_account' => { 'desc' => 'Create role account.', 'object' => [qw(cipux_role_object)], 'action' => 'create_object_action', 'overwrite' => { 'cipux_account.user' => { 'cipuxFirstname' => 'Role', 'cipuxLastname' => 'Account', 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => 'role', }, 'cipux_role.group' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => 'role', #'groupType' => 'authority_group', }, }, 'dog' => { # The dog "post" section will be executed after the task # was issued. In this case after the object was created. # The mandatory key "cipux_dog" specify a section in # cipux-dog.conf. The key-word "@object@" will be replaced # with the value of -o or --object that was given with # the cipux_task_client on the command line or it will # be replaced by the value of the hash reference # { object => 'value', } via a library call. @object@ # might be empty or undef. 'post' => { # refers to a cipux_dogs entry in cipux-dog.conf 'cipux_dog' => 'create_homedir', # defines @user@ in cipux-dog.conf 'user' => '@object@', # defines @role@ in cipux-dog.conf 'role' => 'role', }, }, }, 'cipux_task_destroy_role_account' => { 'desc' => 'Destroy role account.', 'object' => [qw(cipux_role_object)], 'action' => 'destroy_object_action', }, 'cipux_task_list_role_accounts' => { 'desc' => 'List all role accounts.', 'object' => [qw(authority_role_object)], 'action' => 'list_object_action', 'filter' => { 'authority_account.group' => { 'groupType' => 'authority_group', }, }, 'ltarget' => 'cn', }, 'cipux_task_list_members_of_role_account' => { 'desc' => 'List all members of a given role account.', 'object' => [qw(cipux_role_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'groupType' => 'authority_group', }, }, 'target' => { 'cipux_role.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'memberUid', }, # cipux_ldap_set_value -a -t cipux_account.group -y memberUid=xxx -o bibeutlin #mod filter [&(cn=bibeutlin)(objectClass=cipuxGroup)(cipuxIsAccount=TRUE)] 'cipux_task_add_member_to_role_account' => { 'desc' => 'Add a member to a given role account.', 'object' => [qw(cipux_role_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'groupType' => 'authority_group', }, }, 'target' => { 'cipux_role.group' => { 'memberUid' => 0, 'member' => 'cipux_account.user' }, }, 'changes' => { 'cipux_role.group' => 'add', }, }, 'cipux_task_remove_member_from_role_account' => { 'desc' => 'Remove a member from a given role account.', 'object' => [qw(cipux_role_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_role.group' => { 'memberUid' => 0, 'member' => 'cipux_account.user' }, }, 'changes' => { 'cipux_role.group' => 'delete', }, }, # +-----------------------------------------------------------------+ # | skel | # +-----------------------------------------------------------------+ 'cipux_task_create_skel_account' => { 'desc' => 'Create skel account.', 'object' => [qw(cipux_skel_object)], 'action' => 'create_object_action', 'overwrite' => { 'cipux_account.user' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => 'role', }, 'cipux_account.group' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => 'role', }, }, 'dog' => { 'post' => { 'cipux_dog' => 'create_homedir', 'user' => '@object@', 'role' => 'role', }, }, }, 'cipux_task_destroy_skel_account' => { 'desc' => 'Destroy skel account.', 'object' => [qw(cipux_skel_object)], 'action' => 'destroy_object_action', }, 'cipux_task_list_skel_accounts' => { 'desc' => 'List all skel accounts.', 'object' => [qw(cipux_skel_object)], 'action' => 'list_object_action', 'filter' => { 'cipux_account.user' => { 'cipuxRole' => 'role', 'cipuxIsRole' => 'TRUE', 'cipuxIsSkel' => 'TRUE', }, 'cipux_account.group' => { 'cipuxRole' => 'role', 'cipuxIsRole' => 'TRUE', 'cipuxIsSkel' => 'TRUE', }, }, 'ltarget' => 'uid', }, 'cipux_task_list_members_of_skel_account' => { 'desc' => 'List all members of a given skel account.', 'object' => [qw(cipux_skel_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxRole' => 'role', 'cipuxIsRole' => 'TRUE', 'cipuxIsSkel' => 'TRUE', }, }, 'target' => { 'cipux_account.group' => { 'memberUid' => 0 }, }, 'ltarget' => 'memberUid', }, # cipux_ldap_set_value -a -t cipux_account.group -y memberUid=xxx -o bibeutlin #mod filter [&(cn=bibeutlin)(objectClass=cipuxGroup)(cipuxIsAccount=TRUE)] 'cipux_task_add_member_to_skel_account' => { 'desc' => 'Add a member to a given skel account.', 'object' => [qw(cipux_skel_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxRole' => 'role', 'cipuxIsRole' => 'TRUE', 'cipuxIsSkel' => 'TRUE', }, }, 'target' => { 'cipux_account.group' => { 'memberUid' => 0, }, }, 'changes' => { 'cipux_account.group' => 'add', }, }, 'cipux_task_retrieve_all_skel_account_lastname_firstname' => { 'desc' => 'Get firstname and lastname info from all skel accounts.', 'object' => [qw(cipux_account_object)], 'action' => 'list_all_attribute_action', 'filter' => { 'cipux_account.user' => { 'cipuxRole' => 'role', 'cipuxIsRole' => 'TRUE', 'cipuxIsSkel' => 'TRUE', }, }, 'scope' => 'all', 'target' => { 'cipux_account.user' => { 'cipuxLastname' => 0, 'cipuxFirstname' => 0, }, }, 'ltarget' => 'uid', }, 'cipux_task_change_skel_account_password' => { 'desc' => "Change the password of a given skel acccount.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxRole' => 'role', 'cipuxIsRole' => 'TRUE', 'cipuxIsSkel' => 'TRUE', }, }, 'target' => { 'cipux_account.user' => { 'userPassword' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }, ### CAT_module ### 'cipux_task_register_cat_module' => { 'desc' => 'Register a CAT module.', 'object' => ['cipux_cat_module_object'], 'action' => 'create_object_action', 'overwrite' => { 'cipux_cat_module_object' => { 'cipuxRemark' => 'CipUX task layer', }, }, }, 'cipux_task_deregister_cat_module' => { 'desc' => 'De-register a CAT module.', 'object' => ['cipux_cat_module_object'], 'action' => 'destroy_object_action', }, 'cipux_task_list_cat_modules' => { 'desc' => 'List all CAT modules.', 'object' => ['cipux_cat_module_object'], 'action' => 'list_object_action', 'filter' => {}, 'ltarget' => 'cn', }, 'cipux_task_list_enabled_cat_modules' => { 'desc' => 'List all enabled CAT modules.', 'object' => ['cipux_cat_module_object'], 'action' => 'list_object_action', 'filter' => { 'cipux_cat_module_object' => { 'cipuxIsEnabled' => 'TRUE', }, }, 'ltarget' => 'cn', }, 'cipux_task_list_disabled_cat_modules' => { 'desc' => 'List all disabled CAT modules.', 'object' => ['cipux_cat_module_object'], 'action' => 'list_object_action', 'filter' => { 'cipux_cat_module_object' => { 'cipuxIsEnabled' => 'FALSE', }, }, 'ltarget' => 'cn', }, 'cipux_task_retrieve_all_cat_module_name_shortdescription' => { 'desc' => 'Get all "cipuxName" and "cipuxShortDescription info of all CAT modules.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_cat_module' => { 'cipuxName' => 0, 'cipuxShortDescription' => 0, }, }, 'ltarget' => 'cn', }, 'cipux_task_retrieve_all_cat_module_name_shortdescription_templatedir_author_version_license_isenabled_icon' => { 'desc' => 'Get all "cipuxName", "cipuxShortDescription, "cipuxTemplateDir", "cipuxAuthor", "cipuxVersion", "cipuxLicense" , "cipuxIsEnabled" and "cipuxIcon" info of all CAT modules.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_cat_module' => { 'cipuxName' => 0, 'cipuxShortDescription' => 0, 'cipuxTemplateDir' => 0, 'cipuxAuthor' => 0, 'cipuxVersion' => 0, 'cipuxLicense' => 0, 'cipuxIsEnabled' => 0, 'cipuxIcon' => 0, }, }, 'ltarget' => 'cn', }, #'return' => [qw(cn cipuxTemplateDir cipuxShortDescription cipuxScript)], 'cipux_task_retrieve_all_cat_module_name_shortdescription_templatedir_script_isenabled' => { 'desc' => 'Get all "cipuxName", "cipuxShortDescription, "cipuxTemplateDir", "cipuxScript and "cipuxIsEnabled" info of all CAT modules.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_cat_module' => { 'cipuxName' => 0, 'cipuxShortDescription' => 0, 'cipuxTemplateDir' => 0, 'cipuxScript' => 0, 'cipuxIsEnabled' => 0, }, }, 'ltarget' => 'cn', }, 'cipux_task_enable_cat_module' => { 'desc' => 'Enable a given CAT module.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'overwrite' => { 'cipux_cat_module_object' => { 'cipuxIsEnabled' => 'TRUE', }, }, 'filter' => {}, 'target' => { 'cipux_cat_module' => { 'cipuxIsEnabled' => 0, }, }, 'changes' => { 'cipux_cat_module' => 'replace', }, }, # disable 'cipux_task_disable_cat_module' => { 'desc' => 'Disable a given CAT module.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'overwrite' => { 'cipux_cat_module_object' => { 'cipuxIsEnabled' => 'FALSE', }, }, 'filter' => {}, 'target' => { 'cipux_cat_module' => { 'cipuxIsEnabled' => 0, }, }, 'changes' => { 'cipux_cat_module' => 'replace', }, }, # optain 'cipux_task_optain_cat_module_isenabled' => { 'desc' => 'Get "cipuxIsEnabled" from a given CAT module.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_cat_module' => { 'cipuxIsEnabled' => 0, }, }, 'ltarget' => 'cipuxIsEnabled', }, # optain task 'cipux_task_optain_cat_module_task' => { 'desc' => 'Get "cipuxTask" from a given CAT module.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_cat_module' => { 'cipuxTask' => 0, }, }, 'ltarget' => 'cipuxTask', }, 'cipux_task_list_members_of_cat_module' => { 'desc' => 'List all members of a given CAT module.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_cat_module' => { 'cipuxMemberRid' => 0, }, }, 'ltarget' => 'cipuxMemberRid', }, 'cipux_task_add_member_to_cat_module' => { 'desc' => 'Add a member to a given CAT module.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_cat_module' => { 'cipuxMemberRid' => 0, }, }, 'changes' => { 'cipux_cat_module' => 'add', }, }, 'cipux_task_remove_member_from_cat_module' => { 'desc' => 'Remove a member from a given CAT module.', 'object' => [qw(cipux_cat_module_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_cat_module' => { 'cipuxMemberRid' => 0, }, }, 'changes' => { 'cipux_cat_module' => 'delete', }, }, ### task ### 'cipux_task_register_task' => { 'desc' => 'Register a task.', 'object' => ['cipux_task_object'], 'action' => 'create_object_action', 'overwrite' => { 'cipux_task_object' => { 'cipuxRemark' => 'CipUX task layer', }, }, }, 'cipux_task_deregister_task' => { 'desc' => 'De-register a task.', 'object' => ['cipux_task_object'], 'action' => 'destroy_object_action', }, 'cipux_task_list_tasks' => { 'desc' => 'List all tasks stored in LDAP', 'object' => ['cipux_task_object'], 'action' => 'list_object_action', 'filter' => {}, 'ltarget' => 'cn', }, 'cipux_task_list_enabled_tasks' => { 'desc' => 'List all enabled tasks stored in LDAP.', 'object' => ['cipux_task_object'], 'action' => 'list_object_action', 'filter' => { 'cipux_task_object' => { 'cipuxIsEnabled' => 'TRUE', }, }, 'ltarget' => 'cn', }, 'cipux_task_list_disabled_tasks' => { 'desc' => 'List all disabled tasks stored in LDAP.', 'object' => ['cipux_task_object'], 'action' => 'list_object_action', 'filter' => { 'cipux_task_object' => { 'cipuxIsEnabled' => 'FALSE', }, }, 'ltarget' => 'cn', }, 'cipux_task_retrieve_all_task_name_shortdescription' => { 'desc' => 'Get all "cipuxName" and "cipuxShortDescription info of all tasks stored in LDAP.', 'object' => [qw(cipux_task_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_task' => { 'cipuxName' => 0, 'cipuxShortDescription' => 0, }, }, 'ltarget' => 'cn', }, 'cipux_task_retrieve_all_task_name_shortdescription_memberpid_isenabled' => { 'desc' => 'Get all "cipuxName", "cipuxShortDescription, "cipuxMemberPID" and "cipuxIsEnabled" info of all tasks stored in LDAP.', 'object' => [qw(cipux_task_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_task' => { 'cipuxName' => 0, 'cipuxShortDescription' => 0, 'cipuxMemberPID' => 0, 'cipuxIsEnabled' => 0, }, }, 'ltarget' => 'cn', }, 'cipux_task_enable_task' => { 'desc' => 'Enable a given task stored in LDAP.', 'object' => [qw(cipux_task_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'overwrite' => { 'cipux_task_object' => { 'cipuxIsEnabled' => 'TRUE', }, }, 'filter' => {}, 'target' => { 'cipux_task' => { 'cipuxIsEnabled' => 0, }, }, 'changes' => { 'cipux_task' => 'replace', }, }, # disable 'cipux_task_disable_task' => { 'desc' => 'Disable a given task stored in LDAP.', 'object' => [qw(cipux_task_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'overwrite' => { 'cipux_task_object' => { 'cipuxIsEnabled' => 'FALSE', }, }, 'filter' => {}, 'target' => { 'cipux_task' => { 'cipuxIsEnabled' => 0, }, }, 'changes' => { 'cipux_task' => 'replace', }, }, # optain 'cipux_task_optain_task_isenabled' => { 'desc' => 'Get "cipuxIsEnabled" from a given task stored in LDAP.', 'object' => [qw(cipux_task_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_task' => { 'cipuxIsEnabled' => 0, }, }, }, 'cipux_task_add_member_to_task' => { 'desc' => 'Add a member to a given task.', 'object' => [qw(cipux_task_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_task' => { 'cipuxMemberPid' => 0 }, }, 'changes' => { 'cipux_task' => 'add', }, }, 'cipux_task_remove_member_from_task' => { 'desc' => 'Remove a member from a given task.', 'object' => [qw(cipux_task_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_task' => { 'cipuxMemberPid' => 0, }, }, 'changes' => { 'cipux_task' => 'delete', }, }, 'cipux_task_list_members_of_task' => { 'desc' => 'List all members of a given task stored in LDAP.', 'object' => [qw(cipux_task_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_task' => { 'cipuxMemberPid' => 0, }, }, 'ltarget' => 'cipuxMemberPid', }, ### room ### 'cipux_task_create_room' => { 'desc' => 'Create a room.', 'object' => [qw(cipux_room_object)], 'action' => 'create_object_action', 'overwrite' => {}, }, 'cipux_task_destroy_room' => { 'desc' => 'Destroy a room.', 'object' => [qw(cipux_room_object)], 'action' => 'destroy_object_action', }, 'cipux_task_list_rooms' => { 'desc' => 'List all rooms.', 'object' => [qw(cipux_room_object)], 'action' => 'list_object_action', 'filter' => {}, 'ltarget' => 'cn', }, 'cipux_task_optain_room_network_address' => { 'desc' => 'Get a network address of a given room.', 'object' => [qw(cipux_room_object)], 'action' => 'optain_attribute', }, 'cipux_task_change_room_telephone' => { 'desc' => "Change the rooms telephone number.", 'object' => [qw(cipux_room_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'target' => { 'cipux_room' => { 'telephoneNumber' => 0, }, }, 'filter' => { 'cipux_room' => { 'objectClass' => 'cipuxRoom', }, }, 'changes' => { 'cipux_room' => 'replace', }, }, 'cipux_task_change_room_department' => { 'desc' => "Change the rooms department.", 'object' => [qw(cipux_room_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'target' => { 'cipux_room' => { 'cipuxFaculty' => 0, }, }, 'filter' => { 'cipux_room' => { 'objectClass' => 'cipuxRoom', }, }, 'changes' => { 'cipux_room' => 'replace', }, }, 'cipux_task_change_room_location' => { 'desc' => "Change the rooms location.", 'object' => [qw(cipux_room_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'target' => { 'cipux_room' => { 'cipuxAddress' => 0, }, }, 'filter' => { 'cipux_room' => { 'objectClass' => 'cipuxRoom', }, }, 'changes' => { 'cipux_room' => 'replace', }, }, 'cipux_task_change_room_number' => { 'desc' => "Change the rooms number.", 'object' => [qw(cipux_room_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'target' => { 'cipux_room' => { 'roomNumber' => 0, }, }, 'filter' => { 'cipux_room' => { 'objectClass' => 'cipuxRoom', }, }, 'changes' => { 'cipux_room' => 'replace', }, }, 'cipux_task_retrieve_all_room_telephone' => { 'desc' => 'Get all "telephoneNumber" info of all rooms.', 'object' => [qw(cipux_room_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_room' => { 'telephoneNumber' => 0, }, }, }, 'cipux_task_retrieve_all_room_department' => { 'desc' => 'Get all "cipuxFaculty" info of all rooms.', 'object' => [qw(cipux_room_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_room' => { 'cipuxFaculty' => 0, }, }, }, 'cipux_task_retrieve_all_room_number' => { 'desc' => 'Get all "roomNumber" info of all rooms.', 'object' => [qw(cipux_room_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_room' => { 'roomNumber' => 0, }, }, }, 'cipux_task_retrieve_all_room_location' => { 'desc' => 'Get all "cipuxAddress" info of all rooms.', 'object' => [qw(cipux_room_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_room' => { 'cipuxAddress' => 0, }, }, }, ### netgroup ### 'cipux_task_create_netgroup' => { 'desc' => 'Create a netgroup.', 'object' => [qw(cipux_netgroup_object)], 'action' => 'create_object_action', 'overwrite' => {}, }, 'cipux_task_destroy_netgroup' => { 'desc' => 'Destroy a netgroup.', 'object' => [qw(cipux_netgroup_object)], 'action' => 'destroy_object_action', }, 'cipux_task_list_netgroups' => { 'desc' => 'List all netgroups.', 'object' => [qw(cipux_netgroup_object)], 'action' => 'list_object_action', 'filter' => {}, 'ltarget' => 'cn', }, # open LDAP not capabale, see RFC2251 an mail on cipux-devel 2008-05-27 # you can add only ONE client, or you have to use cipuxNetgroupTriple # instead of nisNetgroupTriple #'cipux_task_add_client_to_netgroup' => { # 'desc' => 'Add a triple to a given netgroup.', # 'object' => ['cipux_netgroup_object'], # 'action' => 'change_object_attribute_action', # 'scope' => 'one', # 'filter' => { objectClass => 'nisNetgroup', }, # 'target' => { 'cipux_netgroup' => {'nisNetgroupTriple'=>0,}, }, # 'changes' => { 'cipux_netgroup' => 'add', }, #}, # open LDAP not capabale, see RFC2251 an mail on cipux-devel 2008-05-27 # you can add only ONE client, or you have to use cipuxNetgroupTriple # instead of nisNetgroupTriple #'cipux_task_remove_client_from_netgroup' => { # 'desc' => "Remove a member from a given netgroup.", # 'object' => [qw(cipux_netgroup_object)], # 'action' => 'change_object_attribute_action', # 'scope' => 'one', # 'filter' => # { 'cipux_netgroup' => { objectClass => 'nisNetgroup' }, }, # 'target' => { 'cipux_netgroup' => {'nisNetgroupTriple'=>0,}, }, # 'changes' => { 'cipux_netgroup' => 'delete', }, #}, 'cipux_task_addmodify_all_clients_of_netgroup' => { 'desc' => "Change the client or clients of a given netgroup.", 'object' => ['cipux_netgroup_object'], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'objectClass' => 'nisNetgroup', }, 'target' => { 'cipux_netgroup' => { 'nisNetgroupTriple' => 0, }, }, 'changes' => { 'cipux_netgroup' => 'replace', }, }, 'cipux_task_erase_clients_of_netgroup' => { 'desc' => "Delete all client attributes of a given netgroup.", 'object' => ['cipux_netgroup_object'], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'escope' => 'all', 'filter' => { objectClass => 'nisNetgroup', }, 'target' => { 'cipux_netgroup' => { 'nisNetgroupTriple' => 0, }, }, 'changes' => { 'cipux_netgroup' => 'erase', } , # this deletes a LDAP attribute #'changes' => { 'cipux_netgroup' => 'delete', }, # this deletes a LDAP attribute }, 'cipux_task_list_clients_of_netgroup' => { 'desc' => 'List all members of a given netgroup.', 'object' => [qw(cipux_netgroup_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => {}, 'target' => { 'cipux_netgroup' => { 'nisNetgroupTriple' => 0, }, }, 'shell' => [], 'ltarget' => 'nisNetgroupTriple', }, ### client ### 'cipux_task_list_clients' => { 'desc' => 'List all clients.', 'object' => [qw(cipux_client_object)], 'action' => 'list_object_action', 'scope' => 'all', 'filter' => {}, 'ltarget' => 'cn', }, 'cipux_task_create_client' => { 'desc' => 'Create client.', 'object' => [qw(cipux_client_object)], 'action' => 'create_object_action', 'overwrite' => {}, }, 'cipux_task_destroy_client' => { 'desc' => 'Destroy client.', 'object' => [qw(cipux_client_object)], 'action' => 'destroy_object_action', }, 'cipux_task_change_client_macaddress' => { 'desc' => "Change the clients MAC address.", 'object' => [qw(cipux_client_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'target' => { 'cipux_client' => { 'macAddress' => 0, }, }, 'filter' => { 'cipux_client' => { 'objectClass' => 'cipuxMachine', }, }, 'changes' => { 'cipux_client' => 'replace', }, }, 'cipux_task_change_client_associateddomain' => { 'desc' => "Change the clients MAC address.", 'object' => [qw(cipux_client_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'target' => { 'cipux_client' => { 'associatedDomain' => 0 }, }, 'filter' => { 'cipux_client' => { 'objectClass' => 'cipuxMachine', }, }, 'changes' => { 'cipux_client' => 'replace', }, }, 'cipux_task_change_client_iphostnumber' => { 'desc' => "Change the clients MAC address.", 'object' => [qw(cipux_client_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'target' => { 'cipux_client' => { 'ipHostNumber' => 0, }, }, 'filter' => { 'cipux_client' => { 'objectClass' => 'cipuxMachine', }, }, 'changes' => { 'cipux_client' => 'replace', }, }, 'cipux_task_retrieve_all_client_iphostnumber_domainname_macaddress' => { 'desc' => 'Get all "ipHostNumber", "associatedDomain" and "macAddress" info of all clients.', 'object' => [qw(cipux_client_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_client' => { 'ipHostNumber' => 0, 'associatedDomain' => 0, 'macAddress' => 0, }, }, 'ltarget' => 'cn', }, ### aux functions ### 'cipux_task_sum' => { 'desc' => 'XML-RPC test function. Add two numbers, returns result.', 'object' => [], 'action' => 'special', }, # for class promotion concept 'cipux_task_retrieve_all_uidnumber' => { 'desc' => 'Search for all "uidNumber".', 'object' => [qw(cipux_account_object)], 'action' => 'list_all_attribute_action', 'scope' => 'all', 'filter' => {}, 'target' => { 'cipux_account.user' => { 'uidNumber' => 0, }, }, }, # for class promotion concept 'cipux_task_retrieve_all_gidnumber' => { 'desc' => 'Search for all "gidNumber".', 'object' => [qw(cipux_account_object)], 'action' => 'list_all_attribute_action', 'scope' => 'all', 'filter' => {}, 'target' => { 'cipux_account.user' => { 'gidNumber' => 0, }, }, }, # for class promotion concept 'cipux_task_retrieve_all_primary_group_gidnumber' => { 'desc' => 'Search for all "gidNumber".', 'object' => [qw(cipux_account_object)], 'action' => 'list_all_attribute_action', 'scope' => 'all', 'filter' => {}, 'target' => { 'cipux_account.group' => { 'gidNumber' => 0, }, }, }, # +-------------------------------------------------------------+ # | generic user account | # +-------------------------------------------------------------+ 'cipux_task_create_user_account' => { 'desc' => "Create a user account.", 'object' => [qw(cipux_account_object)], 'action' => 'create_object_action', 'overwrite' => { 'cipux_account.user' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => 'user', }, 'cipux_account.group' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => 'user', }, }, 'dog' => { 'post' => { 'cipux_dog' => 'create_homedir', 'user' => '@object@', 'role' => 'user', }, }, }, 'cipux_task_destroy_user_account' => { 'desc' => "Destroy a user account.", 'object' => [qw(cipux_account_object)], 'action' => 'destroy_object_action', }, 'cipux_task_list_user_accounts' => { 'desc' => "List all user accounts.", 'object' => [qw(cipux_account_object)], 'action' => 'list_object_action', 'filter' => {}, 'ltarget' => 'uid', }, 'cipux_task_list_members_of_user_account' => { 'desc' => "List all members of a given user account.", 'object' => [qw(cipux_account_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxRole' => 'user', }, }, 'target' => { 'cipux_account.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'memberUid', }, # cipux_ldap_set_value -a -t cipux_account.group -y memberUid=xxx -o bibeutlin #mod filter [&(cn=bibeutlin)(objectClass=cipuxGroup)(cipuxIsAccount=TRUE)] 'cipux_task_add_member_to_user_account' => { 'desc' => "Add a member to a given user account.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxRole' => 'user', }, }, 'target' => { 'cipux_account.group' => { 'memberUid' => 0, }, }, 'changes' => { 'cipux_account.group' => 'add', }, }, 'cipux_task_remove_member_from_user_account' => { 'desc' => "Remove a member from a given user account.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxRole' => 'user', }, }, 'target' => { 'cipux_account.group' => { 'memberUid' => 0, }, }, 'changes' => { 'cipux_account.group' => 'delete', }, }, 'cipux_task_change_user_account_password' => { 'desc' => "Change the password of a given user account.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxRole' => 'user', }, }, 'target' => { 'cipux_account.user' => { 'userPassword' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }, # Not used after Dec 2008 #'cipux_task_change_user_account_role' => { # 'desc' => "Change the user account role.", # 'object' => [qw(cipux_account_object)], # 'action' => 'change_object_attribute_action', # 'scope' => 'one', # 'filter' => # { 'cipux_account.user' => { 'cipuxIsAccount' => 'TRUE', }, }, # 'target' => { 'cipux_account.user' =>{'cipuxRole'=>0,}, }, # 'changes' => { 'cipux_account.user' => 'replace', }, #}, 'cipux_task_change_user_account_lastname' => { 'desc' => "Change the user account lastname.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxIsAccount' => 'TRUE', }, }, 'target' => { 'cipux_account.user' => { 'cipuxLastname' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }, 'cipux_task_change_user_account_firstname' => { 'desc' => "Change the user account firstname.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxIsAccount' => 'TRUE', }, }, 'target' => { 'cipux_account.user' => { 'cipuxFirstname' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }, 'cipux_task_retrieve_all_user_account_homedir' => { 'desc' => "Get home directory info from all user accounts.", 'object' => [qw(cipux_account_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_account.user' => { 'homeDirectory' => 0, }, }, 'ltarget' => 'uid', }, 'cipux_task_retrieve_all_user_account_firstname' => { 'desc' => 'Get firstname info from all user accounts.', 'object' => [qw(cipux_account_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_account.user' => { 'cipuxFirstname' => 0, }, }, 'ltarget' => 'uid', }, 'cipux_task_retrieve_all_user_account_lastname' => { 'desc' => "Get lastname info from all user accounts.", 'object' => [qw(cipux_account_object)], 'action' => 'list_all_attribute_action', 'filter' => {}, 'scope' => 'all', 'target' => { 'cipux_account.user' => { 'cipuxLastname' => 0, }, }, 'ltarget' => 'uid', }, 'cipux_task_retrieve_all_user_account_lastname_firstname' => { 'desc' => 'Get firstname, lastname info from all user accounts.', 'object' => [qw(cipux_account_object)], 'action' => 'list_all_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'objectClass' => 'cipuxAccount', }, }, 'target' => { 'cipux_account.user' => { 'cipuxLastname' => 0, 'cipuxFirstname' => 0, }, }, 'ltarget' => 'uid', }, # TODO: replace main role with group based role # Concept of mainrole dropt in Dec 2008 in favor of multi role schema # However a non exclusive main role might reintroduced later #'cipux_task_retrieve_all_user_account_lastname_firstname_role' => { # 'desc' => # "Get first-, lastname and role info from all user accounts.", # 'object' => [qw(cipux_account_object)], # 'action' => 'list_all_attribute_action', # 'filter' => { # 'cipux_account.group' => { 'objectClass' => 'cipuxAccount', }, # }, # 'scope' => 'all', # 'target' => { # 'cipux_account.user' => { # 'cipuxLastname'=>0, # 'cipuxFirstname'=>0, # 'cipuxRole'=>0, # }, # }, #}, 'cipux_task_retrieve_all_user_of_all_role' => { 'desc' => 'Get all users of all roles', 'object' => [qw(cipux_role_object)], 'action' => 'list_all_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'groupType' => 'authority_group', }, }, 'target' => { 'cipux_role.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'uid', }, }, }; #%config = (%{$config0_hr1},%{$config1_hr1},%{$config2_hr1}); #$cfg = \%config; # CipUX CAT module modality: foreach my $m (qw(admin student professor teacher assistant lecturer tutor pupil)) { # +-------------------------------------------------------------+ # | basic user account | # +-------------------------------------------------------------+ my $o = $m; # possible hook to dispatch task name and role: $o =~ s{s$}{}smx; my $task = 'cipux_task_create_' . $o . '_account'; $cfg->{task_api}->{$task} = { 'desc' => "Create a $o account.", 'object' => [qw(cipux_account_object)], 'action' => 'create_object_action', 'overwrite' => { 'cipux_account.user' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => "$m", }, 'cipux_account.group' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => "$m", }, }, 'task' => { 'post' => { 'cipux_task_add_member_to_role_account' => { 'mode' => 'exception', 'attr_hr' => { object => "$m", # role value => '@object@', # member }, }, # TODO OLD #'mode' => 'exception', #'cmd_ar' => ['cipux_task_add_member_to_role_account'], #'attr_ar' => [ # { # object => "$m", # role # value => '@object@', # member # }, #], }, }, 'dog' => { 'post' => { 'cipux_dog' => 'create_homedir', 'user' => '@object@', 'role' => "$m", }, }, }; $task = 'cipux_task_destroy_' . $o . '_account'; $cfg->{task_api}->{$task} = { 'desc' => "Destroy a $o account.", 'object' => [qw(cipux_account_object)], 'action' => 'destroy_object_action', 'task' => { 'post' => { 'cipux_task_remove_member_from_role_account' => { 'mode' => 'exception', 'attr_hr' => { object => "$m", # role value => '@object@', # member }, }, # TODO OLD #'mode' => 'exception', #'cmd_ar' => ['cipux_task_remove_member_from_role_account'], #'attr_ar' => [ # { # object => "$m", # role # value => '@object@', # member # }, #], }, }, }; $task = 'cipux_task_list_' . $o . '_accounts'; $cfg->{task_api}->{$task} = { 'desc' => "List all $o accounts.", 'object' => [qw(cipux_role_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'cn' => "$m", }, }, 'taskobject' => "$m", 'target' => { 'cipux_role.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'memberUid', }; $task = 'cipux_task_list_members_of_' . $o . '_account'; $cfg->{task_api}->{$task} = { 'desc' => "List all members of a given $o account.", 'object' => [qw(cipux_account_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxRole' => "$m", }, }, 'target' => { 'cipux_account.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'memberUid', }; # cipux_ldap_set_value -a -t cipux_account.group -y memberUid=xxx -o bibeutlin #mod filter [&(cn=bibeutlin)(objectClass=cipuxGroup)(cipuxIsAccount=TRUE)] $task = 'cipux_task_add_member_to_' . $o . '_account'; $cfg->{task_api}->{$task} = { 'desc' => "Add a member to a given $o account.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxRole' => "$m", }, }, 'target' => { 'cipux_account.group' => { 'memberUid' => 0, }, }, 'changes' => { 'cipux_account.group' => 'add', }, }; $task = 'cipux_task_remove_member_from_' . $o . '_account'; $cfg->{task_api}->{$task} = { 'desc' => "Remove a member from a given $o account.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxRole' => "$m", }, }, 'target' => { 'cipux_account.group' => { 'memberUid' => 0, }, }, 'changes' => { 'cipux_account.group' => 'delete', }, }; $task = 'cipux_task_change_' . $o . '_account_password'; $cfg->{task_api}->{$task} = { 'desc' => "Change the password of a given $o account.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxRole' => "$m", }, }, 'target' => { 'cipux_account.user' => { 'userPassword' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }; # Concept of mainrole dropt in Dec 2008 in favor of multi role schema # However a non exclusive main role might reintroduced later #$task = 'cipux_task_retrieve_all_' . $o . '_account_mainrole'; #$cfg->{task_api}->{$task} = { # 'desc' => "Get lastname info from all $o accounts.", # 'object' => [qw(cipux_role_object)], # 'action' => 'list_object_attribute_action', # 'scope' => 'one', # 'filter' => { # 'cipux_role.group' => { # 'groupType' => 'authority_group', # 'cn' => "$m" # }, # }, # 'taskobject' => "$m", # 'target' => { 'cipux_role.group' => {'memberUid'=>0,}, }, # 'subtarget' => # { 'cipux_account.user' => [qw(cipuxRole)], }, # 'subfilter' => # { 'cipux_account.user' => { objectClass => 'cipuxAccount' } }, #}; $task = 'cipux_task_change_' . $o . '_account_role'; $cfg->{task_api}->{$task} = { 'desc' => "Change the $o account role.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxIsAccount' => 'TRUE', }, }, 'target' => { 'cipux_account.user' => { 'cipuxRole' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }; # for class promotion concept $task = 'cipux_task_change_' . $o . '_account_homedir'; $cfg->{task_api}->{$task} = { 'desc' => "Change the $o account home directory.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxIsAccount' => 'TRUE', }, }, 'target' => { 'cipux_account.user' => { 'homeDirectory' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }; # for class promotion concept $task = 'cipux_task_change_' . $o . '_account_uidnumber'; $cfg->{task_api}->{$task} = { 'desc' => "Change the $o account UID number.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxIsAccount' => 'TRUE', }, }, 'target' => { 'cipux_account.user' => { 'uidNumber' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }; # for class promotion concept $task = 'cipux_task_change_' . $o . '_account_gidnumber'; $cfg->{task_api}->{$task} = { 'desc' => "Change the $o account GID number.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.user' => { 'cipuxIsAccount' => 'TRUE', }, }, 'target' => { 'cipux_account.user' => { 'gidNumber' => 0, }, }, 'changes' => { 'cipux_account.user' => 'replace', }, }; # for class promotion concept $task = 'cipux_task_change_' . $o . '_account_primary_group_gidnumber'; $cfg->{task_api}->{$task} = { 'desc' => "Change the $o account primary group GID number.", 'object' => [qw(cipux_account_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_account.group' => { 'cipuxIsAccount' => 'TRUE', }, }, 'target' => { 'cipux_account.group' => { 'gidNumber' => 0, }, }, 'changes' => { 'cipux_account.group' => 'replace', }, }; $task = 'cipux_task_retrieve_all_' . $o . '_account_homedir'; $cfg->{task_api}->{$task} = { 'desc' => "Get lastname info from all $o accounts.", 'object' => [qw(cipux_role_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'groupType' => 'authority_group', 'cn' => "$m" }, }, 'taskobject' => "$m", 'target' => { 'cipux_role.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'uid', 'subtarget' => { 'cipux_account.user' => { 'homeDirectory' => 0, }, }, 'subfilter' => { 'cipux_account.user' => { objectClass => 'cipuxAccount' } }, }; $task = 'cipux_task_retrieve_all_' . $o . '_account_firstname'; $cfg->{task_api}->{$task} = { 'desc' => "Get firstname info from all $o accounts.", 'object' => [qw(cipux_role_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'groupType' => 'authority_group', 'cn' => "$m" }, }, 'taskobject' => "$m", 'target' => { 'cipux_role.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'uid', 'subtarget' => { 'cipux_account.user' => { 'cipuxFirstname' => 0, }, }, 'subfilter' => { 'cipux_account.user' => { objectClass => 'cipuxAccount' } }, }; $task = 'cipux_task_retrieve_all_' . $o . '_account_lastname'; $cfg->{task_api}->{$task} = { 'desc' => "Get lastname info from all $o accounts.", 'object' => [qw(cipux_role_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'groupType' => 'authority_group', 'cn' => "$m" }, }, 'taskobject' => "$m", 'target' => { 'cipux_role.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'uid', 'subtarget' => { 'cipux_account.user' => { 'cipuxLastname' => 0, }, }, 'subfilter' => { 'cipux_account.user' => { objectClass => 'cipuxAccount' } }, }; # Most used task with sub task section $task = 'cipux_task_retrieve_all_' . $o . '_account_lastname_firstname'; $cfg->{task_api}->{$task} = { 'desc' => "Get firstname and lastname info from all $o accounts.", 'object' => [qw(cipux_role_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'groupType' => 'authority_group', 'cn' => "$m" }, }, 'taskobject' => "$m", 'target' => { 'cipux_role.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'uid', # This task has a sub task section 'subtarget' and 'subfilter' with # defines the sub task. In general it means that the above target # 'memberUid' will be used as a positive list against all accounts # queried by the subfilter. The result is in alphabetical order. # # Example: # 1 task gives: # memberUid: user1 # memberUid: user2 # 2 task gives: # uid user1, cipuxFirstname: fn1, cipuxLastname: ln1 # uid user2, cipuxFirstname: fn2, cipuxLastname: ln2 # uid user3, cipuxFirstname: fn3, cipuxLastname: ln3 # Then the line 3 will be filtered because 'uid' is not in list # 'memberUid' The output will be lines 1-2 'subtarget' => { 'cipux_account.user' => { 'cipuxLastname' => 0, 'cipuxFirstname' => 0, }, }, 'subfilter' => { 'cipux_account.user' => { objectClass => 'cipuxAccount' } }, }; $task = 'cipux_task_retrieve_all_' . $o . '_account_lastname_firstname_role'; $cfg->{task_api}->{$task} = { 'desc' => "Get firstname and lastname info from all $o accounts.", 'object' => [qw(cipux_role_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_role.group' => { 'groupType' => 'authority_group', 'cn' => "$m" }, }, 'taskobject' => "$m", 'target' => { 'cipux_role.group' => ['memberUid'], }, 'ltarget' => 'uid', 'subtarget' => { 'cipux_account.user' => { cipuxLastname => 0, cipuxFirstname => 0, cipuxRole => 0, }, }, 'subfilter' => { 'cipux_account.user' => { objectClass => 'cipuxAccount' } }, }; } # +-------------------------------------------------------------------------+ # | basic group | # +-------------------------------------------------------------------------+ # CipUX CAT module modality: for my $g ( qw(course class studygroup seminar lecture reading workshop tutorial team) ) { # +-----------------------------------------------------------------+ # | basic group share | # +-----------------------------------------------------------------+ my $task = 'cipux_task_create_' . $g . '_share'; $cfg->{task_api}->{$task} = { 'desc' => "Create $g share account.", 'object' => [qw(cipux_share_object)], 'action' => 'create_object_action', 'overwrite' => { 'cipux_share.user' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => $g, }, 'cipux_share.group' => { 'cipuxRemark' => 'CipUX task layer', 'cipuxRole' => $g, }, }, 'dog' => { 'post' => { 'cipux_dog' => 'create_homedir', 'user' => '@object@', 'role' => "$g", }, }, }; $task = 'cipux_task_destroy_' . $g . '_share'; $cfg->{task_api}->{$task} = { 'desc' => "Destroy $g share account.", 'object' => [qw(cipux_share_object)], 'action' => 'destroy_object_action', }; # mod filter # [&(uid=*) # (objectClass=cipuxAccount) # (cipuxIsShare=TRUE) # (cipuxRole=course)] $task = 'cipux_task_list_' . $g . '_shares'; $cfg->{task_api}->{$task} = { 'desc' => "List all $g share accounts.", 'object' => [qw(cipux_share_object)], 'action' => 'list_object_action', 'filter' => { 'cipux_share.user' => { 'cipuxRole' => $g, }, 'cipux_share.group' => { 'cipuxRole' => $g, }, }, 'ltarget' => 'uid', }; # cipux_ldap_get_value -t cipux_share.group -o class84 -y memberUid # mod filter [&(cn=class84)(objectClass=cipuxGroup)(cipuxIsShare=TRUE) $task = 'cipux_task_list_members_of_' . $g . '_share'; $cfg->{task_api}->{$task} = { 'desc' => "List all members of a given $g share account.", 'object' => [qw(cipux_share_object)], 'action' => 'list_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_share.group' => { 'cipuxRole' => $g, }, }, 'target' => { 'cipux_share.group' => { 'memberUid' => 0, }, }, 'ltarget' => 'memberUid', }; # cipux_ldap_set_value -a -t cipux_share.group -y memberUid=xxx -o class85 #mod filter [&(cn=class85)(objectClass=cipuxGroup)(cipuxIsShare=TRUE)] $task = 'cipux_task_add_member_to_' . $g . '_share'; $cfg->{task_api}->{$task} = { 'desc' => "Add a member to a given $g share account.", 'object' => [qw(cipux_share_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_share.group' => { 'cipuxRole' => $g, }, }, 'target' => { 'cipux_share.group' => { 'memberUid' => 0, }, }, 'changes' => { 'cipux_share.group' => 'add', }, }; $task = 'cipux_task_remove_member_from_' . $g . '_share'; $cfg->{task_api}->{$task} = { 'desc' => "Remove a member from a given $g share account.", 'object' => [qw(cipux_share_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_share.group' => { 'cipuxRole' => $g, }, }, 'target' => { 'cipux_share.group' => { 'memberUid' => 0, }, }, 'changes' => { 'cipux_share.group' => 'delete', }, }; # 'cipux_task_remove_user_from_course_share', # 'cipux_task_list_user_nonmembers_of_course_share', $task = 'cipux_task_change_' . $g . '_share_password'; $cfg->{task_api}->{$task} = { 'desc' => "Change the password of a given $g account.", 'object' => [qw(cipux_share_object)], 'action' => 'change_object_attribute_action', 'scope' => 'one', 'filter' => { 'cipux_share.user' => { 'cipuxRole' => "$g", }, }, 'target' => { 'cipux_share.user' => { 'userPassword' => 0, }, }, 'changes' => { 'cipux_share.user' => 'replace', }, }; } # ALIAS task my $alias = 'cipux_task_change_user_account_password_interactive'; my $task = 'cipux_task_change_user_account_password'; $cfg->{task_api}->{$alias} = $cfg->{task_api}->{$task}; $alias = 'cipux_task_change_own_password_interactive'; $cfg->{task_api}->{$alias} = $cfg->{task_api}->{$task}; undef $task; undef $alias; return $cfg; doc000755001750001750 011337035217 15040 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7example000755001750001750 011337035217 16473 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/doccipux_cleanup_class_shares.sh000555001750001750 532611337035217 24566 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/doc/example#!/bin/sh # +=======================================================================+ # || cipux_cleanup_class_shares.sh || # || || # || Cleanup script to remove obsolete student accounts || # || from class shares which were removed via || # || cipux_task_client -t cipux_task_destroy_student_account -o $STUDENT # || but still get listed in the class share with || # || cipux_task_client -t cipux_task_list_members_of_class_share -o $CLASSSHARE # || || # || Syntax: || # || cipux_cleanup_class_shares.sh || # || || # || Copyright (C) 2009 by Andreas Brand || # || || # || License: GNU GPL version 2 or any later version. || # || || # +=======================================================================+ # # $Id$ # $Revision$ # $HeadURL$ # $Date$ # $Source$ # abort on uncaught errors: set -e # change this if necessary: CIPUX_HOME_BASE_DIRECTORY="/skole/tjener/home0/" # 1. Go through all classes # while handles share names containing white space correctly: cipux_task_client -t cipux_task_list_class_shares | while read current_class do # 2. Go through all members of specific share # ATTENTION: output is tab separated, so we must convert into newlines # so while can handle member names containing white space correctly: cipux_task_client -t cipux_task_list_members_of_class_share -o "${current_class}" | tr '\t' '\n' | while read current_member do # see if this member is a known login: if ! login_name=$(id -un "${current_member}"); then echo "Member '${current_member}' of class share '${current_class}' doesn't exist anymore --> remove it" # 3. remove obsolete account: cipux_task_client -t cipux_task_remove_member_from_class_share -o "${current_class}" -x value="${current_member}" # remove the home directory as well: user_home_dir="${CIPUX_HOME_BASE_DIRECTORY}${current_member}" if [ -d "$user_home_dir" ]; then echo "Remove obsolete home directory '$user_home_dir' as well ..." rm -r "$user_home_dir" fi else echo "Member '${current_member}' of class share '${current_class}' exists (login name '${login_name}') --> keep it" fi done done t000755001750001750 011337035217 14536 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7perlcriticrc000444001750001750 101711337035217 17302 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/t# CipUX Perl::Critic Configuration # # SEVERITY NAME ...is equivalent to... SEVERITY NUMBER # ---------------------------------------------------- # gentle 5 # stern 4 # harsh 3 # cruel 2 # brutal 1 severity = stern verbose = 11 perlcritic_cpan.t000444001750001750 101011337035217 20211 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/t#!perl # use strict; use warnings; use File::Spec; use Test::More; use English qw(-no_match_vars); if ( not $ENV{TEST_AUTHOR} ) { my $msg = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'; plan( skip_all => $msg ); } eval { require Test::Perl::Critic; }; if ($EVAL_ERROR) { my $msg = 'Test::Perl::Critic required to criticise code'; plan( skip_all => $msg ); } my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' ); Test::Perl::Critic->import( -profile => $rcfile ); all_critic_ok(); leaktrace.t000444001750001750 52411337035217 16774 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/tuse Test::More tests => 1; use Test::LeakTrace; #use Devel::Leak::Object qw{ GLOBAL_bless }; #no_leaks_ok { # use CipUX::Task; # my $object = CipUX::Task->new( { cache_dir => 'blib/cache' } ); #} #'no memory leaks'; leaks_cmp_ok { use CipUX::Task; my $object = CipUX::Task->new( { cache_dir => 'blib/cache' } ); } '<', 52; 00.load.t000444001750001750 23011337035217 16170 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/tuse Test::More tests => 2; BEGIN { use_ok('CipUX::Task'); use_ok('CipUX::Task::Client'); } diag("Testing CipUX::Task $CipUX::Task::VERSION"); perlcritic.t000444001750001750 43611337035217 17203 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/t#!perl use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval { require Test::Perl::Critic; }; if ($EVAL_ERROR) { my $msg = 'Test::Perl::Critic required to for testing PBP compliance'; plan( skip_all => $msg ); } Test::Perl::Critic::all_critic_ok(); pod.t000444001750001750 21411337035217 15617 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/t#!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); refcount.t000444001750001750 104311337035217 16703 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/tuse Test::More tests => 4; use Test::Refcount; use CipUX::Task; my $object1 = CipUX::Task->new( { cache_dir => 'blib/cache' } ); is_oneref( $object1, '$object has a refcount of 1' ); my $otherref1 = $object1; is_refcount( $object1, 2, '$object now has 2 references' ); use CipUX::Task::Client; my $object2 = CipUX::Task::Client->new( { name => 'cipux_task_client', cache_dir => 'blib/cache' } ); is_oneref( $object2, '$object has a refcount of 1' ); my $otherref2 = $object2; is_refcount( $object2, 2, '$object now has 2 references' ); bin000755001750001750 011337035217 15043 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7cipux_task_client000444001750001750 1204011337035217 20650 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/bin#!/usr/bin/perl -w -T # +==========================================================================+ # || Copyright (C) 2007 - 2010 by Christian Kuelker || # || || # || License: GNU General Public License - GNU GPL - version 2 || # || or (at your opinion) any later version || # +==========================================================================+ # ID: $Id$ # Revision: $Revision$ # Head URL: $HeadURL$ # Date: $Date$ # Source: $Source use 5.008001; use strict; use warnings; use CipUX::Task::Client; use version; our $VERSION = qv('3.4.0.7'); delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer # MAIN my $client = CipUX::Task::Client->new( { name => 'cipux_task_client' } ); $client->run( { script => 'cipux_task_client' } ); exit 0; =pod =head1 NAME command line interface to CipUX Task library =head1 VERSION version 3.4.0.7 =head1 SYNOPSIS cipux_task_client [OPTION] -t -o [-x|-y =] abbreviations: ATTR = ATTRIBUTE =head1 OPTIONS Options for all commands: -c | --cfg : cipux-task.conf -D | --debug : print debug messages for developers -h | --help : print help (this message + options) -V | --version : print only version Options for some commands: -t | --task : CipUX::Task command -x | --mattrvalue : multiple LDAP attributes, please see description -y | --attrvalue : one LDAP attribute with multible values, please see description =head1 DESCRIPTION OF OPTIONS =over 4 =item I<--attrvalue> This is option have to be use if a LDAP attribute of object has no possibility to search or do not know its own equality. This attributes are rather seldom, nisNetgroupTriple is such an attribute. It is used for clients of netgroups. If you are not sure use --mattrvalue (-x) instaed. If you want to set a values you should provide them like this: --attrvalue = If you want to delete all values of that attribute you can just provide: --attrvalue =item I<-c> Same as option --cfg. =item I<--cfg> To specify the configuration file, if any. The default location for the configuration file is: (1) ~/.cipux/cipux-task.yaml or (2) /etc/cipux/cipux-task.yaml If both are missing, you have to use this option --cfg to specify one. =item I<-D> Same as option --debug. =item I<--debug> To see more output, what the internals is doing, you can enable the --debug and see more message printed to STDOUT. The suggestion is not to use debug output for production code. =item I<-h> Same as option --help =item I<--help> Prints brief help message. =item I<--mattrvalue> This is option have to be use if a LDAP object has to be created. This option requires always an attribute and a value. Therefore only this syntax is possible: --mattrvalue = The reason for this is to be able to gave the user exact hints when he try to create a object but forget the value. The "m" stands for multiple. So it is possible to give the option several times. =item I<-o> Same as option --object =item I<--object> This option is used to specify the object on which the command is operating. Make sure you choose the right object. Of course this will also fail when the object is not fetchable with (in the objects list of) --task. =item I<-t> Same as option --task. =item I<--task> This option defines the "task name" the command is operating with. A "task name" is a certain command inside the CipUX Task Library. For example "cipux_task_create room". You can easily define new tasks in the configuration file. The default location of this file is /etc/cipux/cipux-task.yaml. =item I<-V> Same as option --version. =item I<--version> Prints the version and exits. =item I<-x> Same as option --mattrvalue. =item I<-y> Same as option --attrvalue. =back =head1 COMMANDS cipux_task_client =head1 SEE ALSO See the CipUX webpage and the manual at L See the mailing list L =head1 AUTHOR Christian Kuelker Echristian.kuelker@cipworx.orgE =head1 COPYRIGHT AND LICENSE Copyright (C) 2007 - 2010 by Christian Kuelker This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =cut lib000755001750001750 011337035217 15041 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7CipUX000755001750001750 011337035217 16031 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/libTask.pm000444001750001750 13130211337035217 17466 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/lib/CipUX# +==========================================================================+ # || Copyright (C) 1999 - 2010 by Christian Kuelker || # || || # || License: GNU General Public License - GNU GPL - version 2 || # || or (at your opinion) any later version || # +==========================================================================+ # ID: $Id: Task.pm 4770 2010-02-17 18:45:25Z christian-guest $ # Revision: $Revision: 4770 $ # Head URL: $HeadURL$ # Date: $Date: 2010-02-17 19:45:25 +0100 (Wed, 17 Feb 2010) $ # Source: $Source$ package CipUX::Task; use 5.008001; use strict; use warnings; use utf8; use Carp; use Class::Std; use CipUX::Object::Action::Create; use CipUX::Object::Action::Destroy; use CipUX::Object::Action::List; use CipUX::Object::Action::Attribute::List; use CipUX::Object::Action::Attribute::Change; use Data::Dumper; use English qw( -no_match_vars ); use Log::Log4perl qw(:easy); use Readonly; use Scalar::Util qw(looks_like_number); # core since Perl 5.8 use Term::ReadKey; use base qw(CipUX); { # BEGIN CLASS use version; our $VERSION = qv('3.4.0.7'); use re 'taint'; # Keep data captured by parens tainted delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Make %ENV safe # +======================================================================+ # || CONST || # +======================================================================+ Readonly::Scalar my $EMPTY_STRING => q{}; # +======================================================================+ # || OBJECT || # +======================================================================+ my %task_api_cfg : ATTR( :get ); # +======================================================================+ # || GLOBAL || # +======================================================================+ # +======================================================================+ # || CONSTRUCTOR || # +======================================================================+ sub BUILD { # +------------------------------------------------------------------+ # | API my ( $self, $obj_id, $arg_r ) = @_; # add prefix for cfg, if needed my $pref = exists $arg_r->{pref} ? $self->l( $arg_r->{pref} ) : $EMPTY_STRING; my $cache_dir = exists $arg_r->{cache_dir} ? $self->l( $arg_r->{cache_dir} ) : $EMPTY_STRING; # +------------------------------------------------------------------+ # | prepare # +------------------------------------------------------------------+ # | main my $cfg_hr = $self->cfg( { 'sub' => 'task', pref => $pref, cache_dir => $cache_dir } ); $task_api_cfg{$obj_id} = $cfg_hr->{task_api}; undef $cfg_hr; # +------------------------------------------------------------------+ # | API return; } # +======================================================================+ # || DESTRUCTOR || # +======================================================================+ sub DEMOLISH { # +------------------------------------------------------------------+ # | API my ( $self, $ident ) = @_; # +------------------------------------------------------------------+ # | main delete $task_api_cfg{$ident}; # +------------------------------------------------------------------+ # | API return; } # +======================================================================+ # || open module features || # +======================================================================+ # +======================================================================+ # || task || # +======================================================================+ sub task { #API # $opject, see below my ( $self, $arg_r ) = @_; my $mode = exists $arg_r->{mode} ? $self->l( $arg_r->{mode} ) : $self->perr('mode'); my $script = exists $arg_r->{script} ? $self->l( $arg_r->{script} ) : $self->perr('script'); my $task = exists $arg_r->{task} ? $self->l( $arg_r->{task} ) : $self->perr('task'); my $cfg_task_api_hr = $task_api_cfg{ ident $self}; my %task_api = %{$cfg_task_api_hr}; my $action = exists $arg_r->{action} ? $self->l( $arg_r->{action} ) : $task_api{$task}{action}; my $attr_hr = exists $arg_r->{attr_hr} ? $self->h( $arg_r->{attr_hr} ) : $self->perr('attr_hr'); # +------------------------------------------------------------------+ # | main my $logger = get_logger(__PACKAGE__); $logger->debug('BEGIN'); $logger->debug( '> mode : ', $mode ); $logger->debug( '> script : ', $script ); $logger->debug( '> action : ', $action ); $logger->debug( '> task : ', $task ); #$logger->debug( '> attr_hr : ', {filter=>\&Dumper, value=>$attr_hr}); # test if given task is a valid task if ( not defined( $task_api{$task}{object} ) ) { my $msg = 'Given task is not valid! '; $msg .= '(Not defined in configuration file.) '; $msg .= 'Did you write it correct? '; $msg .= '(use cipux_task_client -l to see all valid tasks.) '; $msg .= 'The task you gave was:'; $self->exc( { msg => $msg, value => $task } ); } ## end if ( not defined( $task_api... my @type = @{ $task_api{$task}{object} }; foreach my $type (@type) { if ( defined($type) ) { my $msg = "task called:"; $logger->debug( $msg . q{: }, $task ); $msg = "task has obj type:"; $logger->debug( $msg . q{: }, $type ); } else { my $msg = 'object type undef for task:'; $self->exc( { msg => $msg, value => $task } ); } # +-------------------------------------------------------------+ # | create_object_action | # +-------------------------------------------------------------+ # A-Z task actions if ( $action eq 'create_object_action' ) { my $object = exists $arg_r->{object} ? $self->l( $arg_r->{object} ) : $self->perr('object'); my $cipux = new CipUX::Object::Action::Create(); my $overwrite_hr = undef; if ( defined( $task_api{$task}{overwrite} ) ) { $overwrite_hr = $task_api{$task}{overwrite}; $logger->debug('got overwrite from cipux-task.conf'); $logger->debug( 'overwrite_hr: ', { filter => \&Dumper, value => $overwrite_hr } ); } else { $logger->debug('got NO overwrite from cipux-task.conf'); } my $return_hr = $cipux->create_object_action( { action => $action, type => $type, object => $object, attr_hr => $attr_hr, overwrite_hr => $overwrite_hr, } ); # execute additional tasks as post hook if ( exists $task_api{$task}{task}{post} ) { $logger->debug('Execute post task'); $logger->debug("> object $object"); $logger->debug("> task $task"); $self->snd_task( { object => $object, post_task_hr => $task_api{$task}{task}{post} } ); } # create_object_action return (main task) my $status_hr = { status => 'OK', type => 'href', taskres_r => $return_hr, ltarget => 'NULL', }; # if there is a doggy in cipux-task.conf we let the dog run if ( exists $task_api{$task}{dog}{post} ) { $logger->debug('dog def exists, try exec (start)'); $self->exec_task_dog( { dog_hr => $task_api{$task}{dog}{post}, object => $object, overwrite_hr => {}, } ); $logger->debug('dog def exists, try exec (end)'); } else { $logger->debug('no dog section in cipux-task.conf'); } return $status_hr; } ## end if ( $action eq 'create_object_action') # +-------------------------------------------------------------+ # | destroy_object_action | # +-------------------------------------------------------------+ elsif ( $action eq 'destroy_object_action' ) { my $object = exists $arg_r->{object} ? $self->l( $arg_r->{object} ) : $self->perr('object'); my $cipux = CipUX::Object::Action::Destroy->new(); my $return_hr = $cipux->destroy_object_action( { action => $action, type => $type, object => $object, attr_hr => {}, } ); # execute additional tasks as post hook if ( exists $task_api{$task}{task}{post} ) { $logger->debug('Execute post task'); $logger->debug("> object $object"); $logger->debug("> task $task"); $self->snd_task( { object => $object, post_task_hr => $task_api{$task}{task}{post} } ); } # destroy_object_action return my $status_hr = { status => 'OK', type => 'href', taskres_r => $return_hr, ltarget => 'NULL', }; # if there is a doggy in cipux-task.conf we let the dog run if ( exists $task_api{$task}{dog}{post} ) { $logger->debug('dog def exists, try exec (start)'); $self->exec_task_dog( { dog_hr => $task_api{$task}{dog}{post}, object => $object, overwrite_hr => {}, } ); $logger->debug('dog def exists, try exec (end)'); } else { $logger->debug('no dog section in cipux-task.conf'); } return $status_hr; } ## end elsif ( $action eq 'destroy_object_action') # +-------------------------------------------------------------+ # | list_object_action | # +-------------------------------------------------------------+ elsif ( $action eq 'list_object_action' ) { my $scope = 'all'; if ( not defined( $task_api{$task}{filter} ) ) { my $msg = 'The filter section in configuration file '; $msg .= "is not defined. "; $msg .= 'Please check that the configuration is up to'; $msg .= 'date and that there is a [\'filter\' => {] '; $msg .= 'section in the task:'; $self->exc( { msg => $msg, value => $task } ); } ## end if ( not defined( $task_api... my %filter = %{ $task_api{$task}{filter} }; my $cipux = CipUX::Object::Action::List->new(); my $return_hr = $cipux->list_object_action( { action => $action, type => $type, attr_hr => {}, filter_hr => \%filter } ); #print "MODE $mode\n"; if ( $mode eq 'shell' ) { foreach my $key ( sort keys %$return_hr ) { #print "$key\t".$return_hr->{$key}."\n"; print "$key\n"; } } ## end if ( $mode eq 'shell' ) my $ltarget = ( exists $task_api{$task}{ltarget} ) ? $task_api{$task}{ltarget} : 'NULL'; $logger->debug("ltarget [$ltarget]"); # list_object_action return my $status_hr = { status => 'OK', type => 'href', taskres_r => $return_hr, ltarget => $ltarget, }; # if there is a doggy in cipux-task.conf we let the dog run if ( exists $task_api{$task}{dog}{post} ) { $logger->debug('dog def exists, try exec (start)'); $self->exec_task_dog( { dog_hr => $task_api{$task}{dog}{post}, object => undef, overwrite_hr => {}, } ); $logger->debug('dog def exists, try exec (end)'); } else { $logger->debug('no dog section in cipux-task.conf'); } return $status_hr; } ## end elsif ( $action eq 'list_object_action') # +-------------------------------------------------------------+ # | list_object_attribute_action | # +-------------------------------------------------------------+ elsif ($action eq 'list_object_attribute_action' or $action eq 'list_all_attribute_action' ) { # we do need an object only for list_object_... # if it is not given via CLI we would # make a last resort to get from cipux-task.conf # $task_api{$task}{taskobject} my $object = undef; if ( $action eq 'list_object_attribute_action' ) { $object = ( exists $arg_r->{object} and defined $arg_r->{object} and $arg_r->{object} ne $EMPTY_STRING ) ? $self->l( $arg_r->{object} ) : ( exists $task_api{$task}{taskobject} and defined $task_api{$task}{taskobject} ) ? $self->l( $task_api{$task}{taskobject} ) : $self->perr('object'); my $msg = 'Parameter "object" is not defined in task'; if ( not defined $object ) { $self->exc( { msg => $msg, value => $task } ); } $msg = 'Parameter "object" is empty in task!'; $msg .= ' On command line please supply -o or --object.'; $msg .= ' The command was:'; if ( $object eq $EMPTY_STRING ) { $self->exc( { msg => $msg, value => $task } ); } } ## end if ( $action eq 'list_object_attribute_action') if ( not defined( $task_api{$task}{filter} ) ) { my $msg = 'The filter section in configuration file '; $msg .= "is not defined. "; $msg .= 'Please check that the configuration is up to'; $msg .= 'date and that there is a [\'filter\' => {] '; $msg .= 'section in the task:'; $self->exc( { msg => $msg, value => $task } ); } ## end if ( not defined( $task_api... my %filter = %{ $task_api{$task}{filter} }; if ( not defined( $task_api{$task}{target} ) ) { my $msg = 'The target section in configuration file '; $msg .= "is not defined. "; $msg .= 'Please check that the configuration is up to'; $msg .= 'date and that there is a [\'target\' => {] '; $msg .= 'section in the task:'; $self->exc( { msg => $msg, value => $task } ); } ## end if ( not defined( $task_api... my %target = %{ $task_api{$task}{target} }; my $scope = $task_api{$task}{scope}; if ( not defined($scope) ) { my $msg = "No scope defined in cfg for task"; $self->exc( { msg => $msg, value => $task } ); } if ( $scope eq $EMPTY_STRING ) { my $msg = "Empty scope in cfg for task"; $self->exc( { msg => $msg, value => $task } ); } $logger->debug( 'scope1: ', $scope ); my $cipux = CipUX::Object::Action::Attribute::List->new(); my $return_hr = $cipux->list_object_attribute_action( { action => $action, type => $type, object => $object, scope => $scope, filter_hr => \%filter, target_hr => \%target, attr_hr => $attr_hr } ) || {}; my $status1_hr = { status => 'OK', type => 'href', taskres_r => $return_hr, }; # 'taskres_r' => { # 'admins' => { # 'cn' => [ # 'admins' # ], # 'memberUid' => [ # 'cipadmin', # 'angmer', # 'berta', # 'myadmin', # 'willi' # ] # } # }, my @object = (); #print Dumper( \@object ); # execute a subtask to get more data if ( exists $task_api{$task}{subtarget} and defined $task_api{$task}{subtarget} and ref $task_api{$task}{subtarget} eq 'HASH' and exists $task_api{$task}{subfilter} and defined $task_api{$task}{subfilter} and ref $task_api{$task}{subfilter} eq 'HASH' ) { $logger->debug('execute a subtask to get more data'); my @target = (); # cycle over cipux_objects of targets foreach my $o ( keys %{ $task_api{$task}{target} } ) { foreach my $t ( sort keys %{ $task_api{$task}{target}->{$o} } ) { $logger->debug( "add target [$t] for cipux object [$o]"); push @target, $t; } } foreach my $key1 ( keys %{$return_hr} ) { $logger->debug("get key1 [$key1] from return_hr"); foreach my $key2 ( keys %{ $return_hr->{$key1} } ) { $logger->debug("get key2 [$key2] from return_hr"); # next of not target (memberUid) next if not grep { $_ =~ $key2 } @target; $logger->debug("this is a target [$key2]"); push @object, @{ $return_hr->{$key1}->{$key2} }; } } %target = %{ $task_api{$task}{subtarget} }; %filter = %{ $task_api{$task}{subfilter} }; $return_hr = $cipux->list_object_attribute_action( { action => $action, type => $type, object => '*', #$object, scope => $scope, filter_hr => \%filter, target_hr => \%target, attr_hr => $attr_hr } ) || {}; $logger->debug('remove not apropriate id'); $logger->debug( 'positive list has ' . scalar @object . ' objects' ); # if we have a subtarget, we would like to delete # unneeded oid if ( scalar @object > 0 ) { # sub target print and weed $logger->debug('we have to filter output'); foreach my $id ( sort keys %{$return_hr} ) { if ( grep { $_ eq $id } @object ) { $logger->debug("id [$id] is OK"); } else { $logger->debug("delete id [$id]"); delete $return_hr->{$id}; } } } else { $logger->debug('we have to delete output'); $return_hr = {}; } } else { $logger->debug('no subtasks executed'); } #print "MODE $mode\n"; if ( $mode eq 'shell' ) { my $print_target = {}; foreach my $obj ( sort keys %target ) { # cipux_share.group, ... $logger->debug( 'object: ', $obj ); foreach my $attr ( sort keys %{ $target{$obj} } ) { # memberUid $logger->debug( 'attribute: ', $attr ); $print_target->{$attr} = 1; } } ## end foreach my $obj ( sort keys... foreach my $id ( sort keys %{$return_hr} ) { print $id; foreach my $attr ( sort keys %{ $return_hr->{$id} } ) { if ( $print_target->{$attr} ) { #print "\t".$attr; foreach my $value ( @{ $return_hr->{$id}->{$attr} } ) { print "\t" . $value; } } ## end if ( $print_target->{$attr... } ## end foreach my $attr ( sort keys... print "\n"; } ## end foreach my $id ( sort keys ... } ## end if ( $mode eq 'shell' ) my $ltarget = ( exists $task_api{$task}{ltarget} ) ? $task_api{$task}{ltarget} : 'NULL'; $logger->debug("ltarget [$ltarget]"); # list_object_attribute_action my $status_hr = { status => 'OK', type => 'href', taskres_r => $return_hr, ltarget => $ltarget, }; # if there is a doggy in cipux-task.conf we let the dog run if ( exists $task_api{$task}{dog}{post} ) { $logger->debug('dog def exists, try exec (start)'); $self->exec_task_dog( { dog_hr => $task_api{$task}{dog}{post}, object => $object, overwrite_hr => {}, } ); $logger->debug('dog def exists, try exec (end)'); } else { $logger->debug('no dog section in cipux-task.conf'); } return $status_hr; } ## end elsif ( $action eq 'list_object_attribute_action'... # +-------------------------------------------------------------+ # | change_object_attribute_action | # +-------------------------------------------------------------+ elsif ( $action eq 'change_object_attribute_action' ) { $logger->debug( ' . this is: ', $action ); # API my $object = exists $arg_r->{object} ? $self->l( $arg_r->{object} ) : $self->perr('object'); # get target value from CLI: -x value=VALUE from CLI my $target_value = $attr_hr->{value}; if ( not defined $object or $object eq $EMPTY_STRING ) { my $msg = 'Parameter "object" was not given or is empty'; $msg .= ' in task!'; $msg .= ' On command line please supply -o or --object.'; $msg .= ' The command was:'; $self->exc( { msg => $msg, value => $task } ); } # if we get empty attr_hr and no value=X via # call or CLI, give up. if ( not defined $target_value and scalar keys( %{$attr_hr} ) < 1 ) { if ( $mode eq 'shell' and $task =~ m{^cipux_task_change_}smx and $task =~ m{_password_interactive$}smx ) { my $p1 = $self->password_prompt( { prompt => 'Enter new password: ' } ); my $p2 = $self->password_prompt( { prompt => 'Enter same password again: ' } ); if ( $p1 eq $p2 ) { $target_value = $p1; #$attr_hr->{userPassword} = [$p1]; $attr_hr->{value} = $p1; } else { croak '(EXCEPTION): Passwords are not equal!'; } } else { my $msg = 'Parameter "value" was not given'; $msg .= ' in task!'; $msg .= ' On command line please supply'; $msg .= ' -x value=VALUE or'; $msg .= ' --mattrvalue value=VALUE.'; $msg .= ' The command was:'; $self->exc( { msg => $msg, value => $task } ); } } $logger->debug( '> object: ', $object ); $logger->debug( 'target_value: ', $target_value ); # need filter section if ( not defined( $task_api{$task}{filter} ) ) { my $msg = 'The filter section in configuration file '; $msg .= "cfg is not defined. "; $msg .= 'Please check that the configuration is up to'; $msg .= 'date and that there is a [\'filter\' => {} '; $msg .= 'section in the task:'; $self->exc( { msg => $msg, value => $task } ); } ## end if ( not defined( $task_api... my %filter = %{ $task_api{$task}{filter} }; $logger->debug( 'hash filter: ', { filter => \&Dumper, value => \%filter } ); # need attr section if ( not defined( $task_api{$task}{target} ) ) { my $msg = 'The target section in configuration file '; $msg .= "cfg is not defined. "; $msg .= 'Please check that the configuration is up to'; $msg .= 'date and that there is a [\'target\' => {] '; $msg .= 'section in the task:'; $self->exc( { msg => $msg, value => $task } ); } ## end if ( not defined( $task_api... my %target = %{ $task_api{$task}{target} }; $logger->debug( 'hash target: ', { filter => \&Dumper, value => \%target } ); # need changes section my %changes = %{ $task_api{$task}{changes} }; $logger->debug( 'hash changes: ', { filter => \&Dumper, value => \%changes } ); $logger->debug( 'hash attr_hr: ', { filter => \&Dumper, value => $attr_hr } ); # need scope my $scope = $task_api{$task}{scope}; if ( not defined($scope) ) { my $msg = "No scope defined in cfg for task"; $self->exc( { msg => $msg, value => $task } ); } # check for overwrite (default values) if $value is empty if ( not defined $target_value ) { $logger->debug('TODO'); $logger->debug( 'target value not defined, using overwrite'); $logger->debug( 'type: ', $type ); if ( defined %{ $task_api{$task}{overwrite} } ) { my %overwrite = %{ $task_api{$task}{overwrite} }; $logger->debug( 'hash overwrite: ', { filter => \&Dumper, value => \%overwrite } ); # Example: # %overwrite = ( # 'cipux_cat_module_object' => { # 'cipuxIsEnabled' => 'TRUE' # } # ); foreach my $o ( keys %overwrite ) { $logger->debug( 'o: ', $o ); foreach my $k ( keys %{ $overwrite{$o} } ) { $logger->debug( 'k: ', $k ); $attr_hr->{$k} = $overwrite{$o}->{$k}; } } ## end foreach my $o ( keys %overwrite) } else { $logger->debug('WARNING: empty value and overwrite!'); } } ## end if ( not defined $value) $logger->debug('will call change'); $logger->debug( 'action :', $action ); $logger->debug( 'type :', $type ); $logger->debug( 'object :', $object ); $logger->debug( 'target_value:', $target_value ); $logger->debug( 'attr_hr : ', { filter => \&Dumper, value => $attr_hr } ); $logger->debug( 'scope:', $scope ); $logger->debug( 'hash filter : ', { filter => \&Dumper, value => \%filter } ); $logger->debug( 'hash changes: ', { filter => \&Dumper, value => \%changes } ); $logger->debug( 'hash target : ', { filter => \&Dumper, value => \%target } ); my $cipux = CipUX::Object::Action::Attribute::Change->new(); my $return_hr = $cipux->change_object_attribute_action( { action => $action, type => $type, object => $object, value => $target_value, attr_hr => $attr_hr, scope => $scope, filter_hr => \%filter, changes_hr => \%changes, target_hr => \%target, } ); #if ( $debug > 128 and defined($return_hr) ) { # #$self->var_dump( { var_r => $return_hr, name => 'return_hr' } ); # } #else { # $logger->debug('did return nothing!'); #} # change_object_attribute_action return my $status_hr = { status => 'OK', type => 'href', taskres_r => $return_hr, ltarget => 'NULL', }; # if there is a doggy in cipux-task.conf we let the dog run if ( exists $task_api{$task}{dog}{post} ) { $logger->debug('dog def exists, try exec (start)'); $self->exec_task_dog( { dog_hr => $task_api{$task}{dog}{post}, object => $object, overwrite_hr => {}, } ); $logger->debug('dog def exists, try exec (end)'); } else { $logger->debug('no dog section in cipux-task.conf'); } return $status_hr; } ## end elsif ( $action eq 'change_object_attribute_action') # +-------------------------------------------------------------+ # | decision_on_object_attribute_action | # +-------------------------------------------------------------+ elsif ( $action eq 'decision_on_object_attribute_action' ) { # TODO } elsif ( $action eq 'optain_attribute' ) { } else { my $msg = "unknown CipUX action [$action] for task:"; $self->exc( { msg => $msg, value => $task } ); } } ## end foreach my $type (@type) # here come task without LDAP if ( $action eq 'special' ) { my $msg = 'execute special task'; $logger->debug( $msg . q{: }, $task ); if ( $mode eq 'shell' ) { my $msg = 'This is probably not a number. '; $msg .= 'Please use only numbers!'; ReadMode('normal'); print 'Input 1st summand: '; my $r1 = ReadLine 0; my $s1 = $self->l($r1); if ( not looks_like_number($s1) ) { # Scalar::Util $self->exc( { msg => $msg } ); } print 'Input 2nd summand: '; my $r2 = ReadLine 0; my $s2 = $self->l($r2); if ( not looks_like_number($s2) ) { # Scalar::Util $self->exc( { msg => $msg } ); } my $sum = $s1 + $s2; print 'Result: ' . $sum . "\n"; return $sum; } else { if ( $task eq 'cipux_task_sum' ) { my $s1 = ref $attr_hr->{summand1} eq 'ARRAY' ? $attr_hr->{summand1}->[0] : $attr_hr->{summand1}; my $s2 = ref $attr_hr->{summand2} eq 'ARRAY' ? $attr_hr->{summand2}->[0] : $attr_hr->{summand2}; my $sum = $s1 + $s2; # no LDAP task return return { status => 'OK', type => 'aref', taskres_r => [$sum], ltarget => 'NULL', }; } ## end if ( $task eq 'cipux_task_sum') } ## end else [ if ( $mode eq 'shell' ) } ## end if ( $action eq 'special') } ## end sub task # +======================================================================+ # || list_task || # +======================================================================+ sub list_task { # API my ( $self, $arg_r ) = @_; # +------------------------------------------------------------------+ # | prepare my $logger = get_logger(__PACKAGE__); $logger->debug('BEGIN'); my $cfg_task_api_hr = $task_api_cfg{ ident $self}; my @return; my $cfg_hr = $cfg_task_api_hr; # list all object # $logger->debug('cfg_hr: ', $cfg_hr ); foreach my $name ( sort keys %{$cfg_hr} ) { $logger->debug( 'task: ', $name ); push( @return, $name ); } return \@return; } ## end sub list_task # +======================================================================+ # || exec_task_dog || # +======================================================================+ sub exec_task_dog { # +------------------------------------------------------------------+ # | API my ( $self, $arg_r ) = @_; my $object = exists $arg_r->{object} ? $self->l( $arg_r->{object} ) : $self->perr('object'); my $dog_hr = exists $arg_r->{dog_hr} ? $self->h( $arg_r->{dog_hr} ) : $self->perr('dog_hr'); my $overwrite_hr = exists $arg_r->{overwrite_hr} ? $self->h( $arg_r->{overwrite_hr} ) : $self->perr('overwrite_hr'); my $logger = get_logger(__PACKAGE__); $logger->debug('Check if CipUX::Dog is installed ... '); # if CipUX::Dog is installed, we use it eval { require CipUX::Dog; }; if ( not $EVAL_ERROR ) { $logger->debug('... CipUX::Dog is installed'); my $dog = CipUX::Dog->new( { dog_hr => $dog_hr, object => $object, overwrite_hr => $overwrite_hr, } ); $logger->debug('execute the dog'); $dog->bite(); # exec files system command } else { $logger->debug( '... no, CipUX::Dog not installed. Will not run the dog.'); } return; } sub snd_task { # +------------------------------------------------------------------+ # | API my ( $self, $arg_r ) = @_; my $object = exists $arg_r->{object} ? $self->l( $arg_r->{object} ) : $self->perr('object'); my $post_task_hr = exists $arg_r->{post_task_hr} ? $self->h( $arg_r->{post_task_hr} ) : $self->perr('post_task_hr'); my $logger = get_logger(__PACKAGE__); $logger->debug("object: $object"); $logger->debug( 'post_task_hr: ', { filter => \&Dumper, value => $post_task_hr } ); # +------------------------------------------------------------------+ # | main # 'task' => { # 'post' => { # 'cipux_task_add_member_to_role_account' => { # 'mode' => 'exception', # 'attr_hr' => { # object => "$m", # role # value => '@object@', # member # }, # }, # }, # }, my $return_hr = {}; my %post = %{$post_task_hr}; $logger->debug( 'post: ', { filter => \&Dumper, value => \%post } ); foreach my $task ( sort keys %post ) { my $attr_hr = $post{$task}->{attr_hr}; # fill in the objetcs foreach my $key ( sort keys %{$attr_hr} ) { my $value = $attr_hr->{$key}; $logger->debug("attr_hr before '$key'=>'$value'"); $value =~ s/\@object\@/$object/gsmx; $logger->debug("attr_hr after '$key'=>'$value'"); $attr_hr->{$key} = $value; } # for all post tasks $logger->debug("task: $task"); $logger->debug("object: $object"); $logger->debug( 'attr_hr', { filter => \&Dumper, value => $attr_hr } ); my $return_r = $self->task( { script => __PACKAGE__, task => $task, mode => 'rpc', object => $attr_hr->{object}, attr_hr => $attr_hr, } ); if ( $return_r->{status} eq 'OK' ) { $logger->debug('2nd task return OK'); } else { $logger->debug('2nd task return FALSE'); } $return_hr->{$task} = $return_r; } return $return_hr; } } # END INSIDE-OUT CLASS 1; =pod =head1 NAME CipUX::Task - Task layer class for CipUX =head1 VERSION version 3.4.0.7 =head1 SYNOPSIS use CipUX::Task; =head1 DESCRIPTION Provides the functions for the XML-RPC daemon and the CipUX shell commands. =head1 ABSTRACT The CipUX task library combines the CipUX LDAP objects and the file system. =head1 SUBROUTINES/METHODS The following functions will be exported by CipUX::Task. =head2 new Constructor B my $cipux_task = CipUX::Task->new(); my $cipux_task = CipUX::Task->new( { pref=>cipux-task.cfgperl } ); B I Configuration files may be provided for convenience but is not needed. If no configuration file was provided the default configuration file will be loaded. This is meant to work in a single server scenario and multi server settings. =head2 list_task List CipUX Task Library commands. B $cipux->list_task({ }); =head1 DIAGNOSTICS TODO =head1 CONFIGURATION AND ENVIRONMENT TODO =head1 DEPENDENCIES Carp Class::Std CipUX::Object::Action::Create CipUX::Object::Action::Destroy CipUX::Object::Action::List CipUX::Object::Action::Attribute::List CipUX::Object::Action::Attribute::Change Data::Dumper English Log::Log4perl Readonly Scalar::Util Term::ReadKey =head1 INCOMPATIBILITIES Not known. =head1 BUGS AND LIMITATIONS Not known. =head1 SEE ALSO See the CipUX webpage and the manual at L See the mailing list L =head1 AUTHOR Christian Kuelker Echristian.kuelker@cipworx.orgE =head1 LICENSE AND COPYRIGHT Copyright (C) 1999 - 2009 by Christian Kuelker This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =cut Task000755001750001750 011337035217 16733 5ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/lib/CipUXClient.pm000444001750001750 3306711337035217 20675 0ustar00ckuelkerckuelker000000000000CipUX-Task-3.4.0.7/lib/CipUX/Task#!/usr/bin/perl -w -T # +==========================================================================+ # || Copyright (C) 2008 - 2010 by Christian Kuelker || # || || # || License: GNU General Public License - GNU GPL - version 2 || # || or (at your opinion) any later version || # +==========================================================================+ # ID: $Id$ # Revision: $Revision$ # Head URL: $HeadURL$ # Date: $Date$ # Source: $Source package CipUX::Task::Client; use warnings; use strict; use Carp; use Class::Std; use Data::Dumper; use Getopt::Long; use Log::Log4perl qw(get_logger :levels); use Pod::Usage; use Readonly; use base qw(CipUX::Task); { # BEGIN INSIDE-OUT CLASS use version; our $VERSION = qv('3.4.0.7'); use re 'taint'; # Keep data captured by parens tainted delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer # +======================================================================+ # || CONSTANTS || # +======================================================================+ Readonly::Scalar my $EMPTY_STRING => q{}; Readonly::Scalar my $LINEWIDTH => 78; Readonly::Array my @ACTION => qw( cipux_task_client ); # +======================================================================+ # || OBJECT || # +======================================================================+ my %name_of : ATTR( init_arg => 'name'); # +======================================================================+ # || GLOBALS || # +======================================================================+ my $L = q{=} x $LINEWIDTH; $L .= "\n"; my $attrvalue_hr = {}; my $mattrvalue_hr = {}; my %opt = (); my $script = $EMPTY_STRING; my %option = ( 'cipux_task_client' => { 'must' => [], 'may' => [ qw(c cfg h ? help D debug l list p pretty V verbose version x mattrvalue o object) ], 'not' => [], }, ); sub run { # +------------------------------------------------------------------+ # | API my ( $self, $arg_r ) = @_; # constructor param from CipUX::Object::Client my $run_action = $name_of{ ident $self}; my $script = $name_of{ ident $self}; # test right away if we have a valid action # is $run_action inside @action? if ( scalar( grep { $_ eq $run_action } @ACTION ) < 1 ) { $self->exc( { msg => 'unknown action', value => $run_action } ); } # +====================================================================+ # || ENVIRONMENT || # +====================================================================+ Getopt::Long::Configure("bundling"); GetOptions( \%opt, "cfg|c=s", "debug|D:s", "help|?|h", "list|l:s", "man", "object|o=s", "pretty|p", "task|t=s", "version|V", "verbose", 'mattrvalue|x=s%' => sub { $self->store_mattrvalue( $mattrvalue_hr, \%opt, @_ ); }, 'attrvalue|y:s%' => sub { $self->store_attrvalue( $attrvalue_hr, \%opt, @_ ); } ) or pod2usage( -exitstatus => 2, -msg => "$L problems parsing command line!\n$L" ); if ( exists $opt{debug} and defined $opt{debug} ) { Log::Log4perl->init_once('/etc/cipux/log4perl.conf'); } my $logger = get_logger(__PACKAGE__); $logger->debug('BEGIN'); $logger->debug( '> run action: ', $run_action ); # display help page if ( exists $opt{help} ) { pod2usage( -exitstatus => 0, -verbose => 1 ); } # display version an exit if ( exists $opt{version} ) { print "$script $VERSION\n"; exit(0); } my $ret = $self->test_cli_option( { script => $run_action, logic_hr => \%option, opt_hr => \%opt, debug => 0, } ); if ( exists $opt{list} ) { $run_action = 'cipux_task_list'; } # +====================================================================+ # || MAIN || # +====================================================================+ my $action = exists $opt{action} ? $opt{action} : undef; my $cfg = exists $opt{cfg} ? $opt{cfg} : undef; my $pretty = exists $opt{pretty} ? 1 : 0; my $object = exists $opt{object} ? $opt{object} : $EMPTY_STRING; my $task = exists $opt{task} ? $opt{task} : $EMPTY_STRING; my $search = exists $opt{list} ? $opt{list} : undef; if ( defined $cfg ) { $logger->debug( '> cfg: ', $cfg ); } if ( defined $object ) { $logger->debug( '> object: ', $object ); } if ( defined $task ) { $logger->debug( '> task: ', $task ); } $action = $run_action; $action =~ s{^.*_}{}gmx; $logger->debug( '> action: ', $action ); $self->$run_action( { action => $action, pretty => $pretty, task => $task, object => $object, search => $search, cfg => $cfg, mattrvalue_hr => $mattrvalue_hr, } ); return; } # +----------------------------------------------------------------------+ # | cipux_task_client | # +----------------------------------------------------------------------+ sub cipux_task_client { # +------------------------------------------------------------------+ # | API my ( $self, $arg_r ) = @_; my $action = exists $arg_r->{action} ? $self->l( $arg_r->{action} ) : $self->perr('action'); my $task = exists $arg_r->{task} ? $self->l( $arg_r->{task} ) : $self->perr('task'); my $object = exists $arg_r->{object} ? $self->l( $arg_r->{object} ) : $self->perr('object'); # +------------------------------------------------------------------+ # | main my $run_action = 'cipux_task_' . $action; if ( scalar( grep { $_ eq $run_action } @ACTION ) < 1 ) { $self->exc( { msg => 'unknown action', value => $run_action } ); } if ( $action ne 'client' ) { $self->$run_action($arg_r); } else { my $return_r = $self->task( { script => $script, task => $task, mode => 'shell', object => $object, attr_hr => $mattrvalue_hr, } ); } # +------------------------------------------------------------------+ # | API return; } # +----------------------------------------------------------------------+ # | cipux_task_list | # +----------------------------------------------------------------------+ sub cipux_task_list { # +------------------------------------------------------------------+ # | API my ( $self, $arg_r ) = @_; my $cfg = exists $arg_r->{cfg} ? $self->l( $arg_r->{cfg} ) : $self->perr('cfg'); my $pretty = exists $arg_r->{pretty} ? $self->l( $arg_r->{pretty} ) : $self->perr('pretty'); my $search = exists $arg_r->{search} ? $self->l( $arg_r->{search} ) : $self->perr('search'); # +------------------------------------------------------------------+ # | main my $logger = get_logger(__PACKAGE__); $logger->debug('BEGIN'); $logger->debug( '> pretty: ', $pretty ); $logger->debug( '> cfg: ', { filter => \&Dumper, value => $cfg } ); $self->_print_list_type( { pretty => $pretty, cfg => $cfg, search => $search } ); # +------------------------------------------------------------------+ # | API return; } # +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ # | PRIVATE INTERFACE | # +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ sub _print_list_type { # +------------------------------------------------------------------+ # | API my ( $self, $arg_r ) = @_; my $pretty = exists $arg_r->{pretty} ? $self->l( $arg_r->{pretty} ) : 0; my $cfg = exists $arg_r->{cfg} ? $self->l( $arg_r->{cfg} ) : 0; my $search = exists $arg_r->{search} ? $self->l( $arg_r->{search} ) : 0; my $logger = get_logger(__PACKAGE__); $logger->debug( 'pretty: ', $pretty ); $logger->debug( 'cfg: ', $cfg ); my $list_ar = $self->list_task(); my @list = ($search) ? grep {m{^.*$search.*$}smx} @{$list_ar} : @{$list_ar}; # mostly this stuff is for pretty print my $max_col = 0; my $width = 0; if ($pretty) { foreach my $line (@list) { $max_col = length($line) if $max_col < length($line); } $width = 2 + $max_col; print '+' . '-' x $width . "+\n"; printf( "| %-" . $max_col . "s |\n", 'task' ); print '+' . '=' x $width . "+\n"; } ## end if($pretty) foreach my $line (@list) { chomp($line); if ($pretty) { printf( "| %-" . $max_col . "s |\n", $line ); } else { print "$line\n"; } } ## end foreach my $line (@list) print '+' . '-' x $width . "+\n" if $pretty; exit(0); } } # END INSIDE-OUT CLASS 1; # Magic true value required at end of module __END__ =head1 NAME CipUX::Task::Client - CLI for CipUX Tasks =head1 VERSION This document describes CipUX::Task::Client version 3.4.0.7 =head1 SYNOPSIS use CipUX::Task::Client; my $client = CipUX::Task::Client->new( { name => 'cipux_task_client' } ); $client->run(); =head1 DESCRIPTION The CipUX::Task::Client library provides common functions for CipUX task commands. =head1 INTERFACE =for author to fill in: Write a separate section listing the public components of the modules interface. These normally consist of either subroutines that may be exported, or methods that may be called on objects belonging to the classes provided by the module. =head1 DIAGNOSTICS =for author to fill in: List every single error and warning message that the module can generate (even the ones that will "never happen"), with a full explanation of each problem, one or more likely causes, and any suggested remedies. =over =item C<< Error message here, perhaps with %s placeholders >> [Description of error here] =item C<< Another error message here >> [Description of error here] [Et cetera, et cetera] =back =head1 CONFIGURATION AND ENVIRONMENT CipUX::Task::Client requires no configuration files or environment variables. =head1 DEPENDENCIES =head1 INCOMPATIBILITIES None reported. =head1 BUGS AND LIMITATIONS No bugs have been reported. =head1 AUTHOR Christian Kuelker C<< >> =head1 LICENCE AND COPYRIGHT Copyright (C) 2008 - 2009 Christian Kuelker. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.