Exemplo n.º 1
0
function setSiteGroupRights($site, $group, $rights)
{
    $application = new \BackBee\Standard\Application();
    $em = $application->getEntityManager();
    $aclProvider = $application->getSecurityContext()->getACLProvider();
    $securityIdentity = new \Symfony\Component\Security\Acl\Domain\UserSecurityIdentity($group->getObjectIdentifier(), 'BackBee\\Security\\Group');
    if (array_key_exists('sites', $rights)) {
        $sites = addSiteRights($rights['sites'], $aclProvider, $securityIdentity, $site);
        if (array_key_exists('layouts', $rights)) {
            addLayoutRights($rights['layouts'], $aclProvider, $securityIdentity, $site, $em);
        }
        if (array_key_exists('pages', $rights)) {
            addPageRights($rights['pages'], $aclProvider, $securityIdentity, $em);
        }
        if (array_key_exists('mediafolders', $rights)) {
            addFolderRights($rights['mediafolders'], $aclProvider, $securityIdentity);
        }
        if (array_key_exists('contents', $rights)) {
            addContentRights($rights['contents'], $aclProvider, $securityIdentity, getAllContentClasses($application));
        }
        if (array_key_exists('bundles', $rights)) {
            addBundleRights($rights['bundles'], $aclProvider, $securityIdentity, $application);
        }
        if (array_key_exists('users', $rights)) {
            addUserRights($rights['users'], $aclProvider, $securityIdentity);
        }
        if (array_key_exists('groups', $rights)) {
            addGroupRights($rights['groups'], $aclProvider, $securityIdentity);
        }
        return $sites;
    }
}
Exemplo n.º 2
0
 *
 * BackBee 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 3 of the License, or
 * (at your option) any later version.
 *
 * BackBee Standard Edition 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 BackBee Standard Edition. If not, see <http://www.gnu.org/licenses/>.
 */
if (!is_file($autoloadFile = __DIR__ . '/../vendor/autoload.php')) {
    echo '<p>BackBee could not find composer autoloader. Did you install and run "composer install --no-dev" command?</p>';
    throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --no-dev"?');
}
require $autoloadFile;
$context = null;
$environment = null;
/**
 * After installation you can delete this check
 * and only keep $application->start();
 */
if (BackBee\Standard\Application::isInstalled()) {
    $application = new \BackBee\Standard\Application($context, $environment);
    $application->start();
} else {
    header('Location: install.php');
}