Source of file SystemtaskLdapsync.php

Size: 2,541 Bytes - Last Modified: 2016-05-18T03:08:26+02:00

buildproject/core/module_ldap/admin/systemtasks/SystemtaskLdapsync.php

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
<?php
/*"******************************************************************************************************
*   (c) 2004-2006 by MulchProductions, www.mulchprod.de                                                 *
*   (c) 2007-2016 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*   $Id$                                        *
********************************************************************************************************/

namespace Kajona\Ldap\Admin\Systemtasks;

use Kajona\Ldap\System\Usersources\UsersourcesSourceLdap;
use Kajona\System\Admin\Systemtasks\AdminSystemtaskInterface;
use Kajona\System\Admin\Systemtasks\SystemtaskBase;
use Kajona\System\System\SystemModule;


/**
 * Syncs the ldap-userbase with the data from the directory
 *
 * @package module_ldap
 * @author sidler@mulchprod.de
 */
class SystemtaskLdapsync extends SystemtaskBase implements AdminSystemtaskInterface
{

    /**
     * contructor to call the base constructor
     */
    public function __construct()
    {
        parent::__construct();

        $this->setStrTextBase("ldap");
    }

    /**
     * @see AdminSystemtaskInterface::getGroupIdenitfier()
     * @return string
     */
    public function getGroupIdentifier()
    {
        return "ldap";
    }

    /**
     * @see AdminSystemtaskInterface::getStrInternalTaskName()
     * @return string
     */
    public function getStrInternalTaskName()
    {
        return "ldapsync";
    }

    /**
     * @see AdminSystemtaskInterface::getStrTaskName()
     * @return string
     */
    public function getStrTaskName()
    {
        return $this->getLang("systemtask_ldapsync_name");
    }

    /**
     * @see AdminSystemtaskInterface::executeTask()
     * @return string
     */
    public function executeTask()
    {

        if (!SystemModule::getModuleByName("ldap")->rightEdit()) {
            return $this->getLang("commons_error_permissions");
        }

        $objUsersources = new UsersourcesSourceLdap();
        $bitSync = $objUsersources->updateUserData();


        if ($bitSync) {
            return $this->objToolkit->getTextRow($this->getLang("systemtask_ldapsync_success"));
        } else {
            return $this->objToolkit->getTextRow($this->getLang("systemtask_ldapsync_error"));
        }
    }


}