final public function getCorrectUserGroups(Userinfo $userinfo)
	{
		$jname = $this->getJname();
		$group = array();

		$master = Framework::getMaster();
		if ($master) {
			if ($master->name == $jname) {
				$group = Groups::get($master->name, true);
			} else {
				$slavegroups = Groups::get($jname);

				$user = Factory::getUser($master->name);
				$index = $user->getUserGroupIndex($userinfo);

				if (isset($slavegroups[$index])) {
					$group = $slavegroups[$index];
				}

				if ($group === null && isset($slavegroups[0])) {
					$group =  $slavegroups[0];
				}
			}
		}
		
		if (!is_array($group)) {
			if ($group !==  null) {
				$group = array($group);
			} else {
				$group = array();
			}
		}
		return $group;
	}