/**
  * @see \C5TL\Parser\DynamicItem::parseManual()
  */
 public function parseManual(\Gettext\Translations $translations, $concrete5version)
 {
     if (class_exists('\\PermissionAccessEntityType', true) && method_exists('\\PermissionAccessEntityType', 'getList')) {
         foreach (\PermissionAccessEntityType::getList() as $aet) {
             $this->addTranslation($translations, $aet->getAccessEntityTypeName(), 'PermissionAccessEntityTypeName');
         }
     }
 }
Exemplo n.º 2
0
	public static function getForUser($user) {
		$entities = array();
		$db = Loader::db();
		$types = PermissionAccessEntityType::getList();
		foreach($types as $t) {
			$entities = array_merge($entities, $t->getAccessEntitiesForUser($user));			
		}
		return $entities;
	}
Exemplo n.º 3
0
 public function run()
 {
     $this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>");
     $this->x->addAttribute('version', '1.0');
     // First, attribute categories
     AttributeKeyCategory::exportList($this->x);
     // attribute types
     AttributeType::exportList($this->x);
     // then block types
     BlockTypeList::exportList($this->x);
     // now attribute keys (including user)
     AttributeKey::exportList($this->x);
     // now attribute keys (including user)
     AttributeSet::exportList($this->x);
     // now theme
     PageTheme::exportList($this->x);
     // now packages
     PackageList::export($this->x);
     // permission access entity types
     PermissionAccessEntityType::exportList($this->x);
     // now task permissions
     PermissionKey::exportList($this->x);
     // workflow types
     WorkflowType::exportList($this->x);
     // now jobs
     Loader::model('job');
     Job::exportList($this->x);
     // now single pages
     $singlepages = $this->x->addChild("singlepages");
     $db = Loader::db();
     $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         $pc->export($singlepages);
     }
     // now page types
     CollectionType::exportList($this->x);
     // now stacks/global areas
     Loader::model('stack/list');
     StackList::export($this->x);
     // now content pages
     $pages = $this->x->addChild("pages");
     $db = Loader::db();
     $r = $db->Execute('select Pages.cID from Pages left join ComposerDrafts on Pages.cID = ComposerDrafts.cID where ComposerDrafts.cID is null and cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         $pc->export($pages);
     }
     Loader::model("system/captcha/library");
     SystemCaptchaLibrary::exportList($this->x);
     Config::exportList($this->x);
 }
Exemplo n.º 4
0
 public function exportAll()
 {
     $this->x = $this->getXMLRoot();
     // First, attribute categories
     AttributeKeyCategory::exportList($this->x);
     // attribute types
     AttributeType::exportList($this->x);
     // then block types
     BlockTypeList::exportList($this->x);
     // now attribute keys (including user)
     AttributeKey::exportList($this->x);
     // now attribute keys (including user)
     AttributeSet::exportList($this->x);
     // now theme
     PageTheme::exportList($this->x);
     // now packages
     PackageList::export($this->x);
     // permission access entity types
     PermissionAccessEntityType::exportList($this->x);
     // now task permissions
     PermissionKey::exportList($this->x);
     // workflow types
     WorkflowType::exportList($this->x);
     // now jobs
     Loader::model('job');
     Job::exportList($this->x);
     // now single pages
     $singlepages = $this->x->addChild("singlepages");
     $db = Loader::db();
     $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc');
     while ($row = $r->FetchRow()) {
         $pc = Page::getByID($row['cID'], 'RECENT');
         $pc->export($singlepages);
     }
     // now page types
     CollectionType::exportList($this->x);
     // now stacks/global areas
     Loader::model('stack/list');
     StackList::export($this->x);
     $this->exportPages($this->x);
     Loader::model("system/captcha/library");
     SystemCaptchaLibrary::exportList($this->x);
     Config::exportList($this->x);
 }
Exemplo n.º 5
0
 /** 
  * Returns an array of package items (e.g. blocks, themes)
  */
 public function getPackageItems()
 {
     $items = array();
     Loader::model('single_page');
     Loader::library('mail/importer');
     Loader::model('job');
     Loader::model('collection_types');
     Loader::model('system/captcha/library');
     Loader::model('system/antispam/library');
     $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this);
     $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this);
     $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this);
     $items['attribute_keys'] = AttributeKey::getListByPackage($this);
     $items['attribute_sets'] = AttributeSet::getListByPackage($this);
     $items['group_sets'] = GroupSet::getListByPackage($this);
     $items['page_types'] = CollectionType::getListByPackage($this);
     $items['mail_importers'] = MailImporter::getListByPackage($this);
     $items['configuration_values'] = Config::getListByPackage($this);
     $items['block_types'] = BlockTypeList::getByPackage($this);
     $items['page_themes'] = PageTheme::getListByPackage($this);
     $items['permissions'] = PermissionKey::getListByPackage($this);
     $items['single_pages'] = SinglePage::getListByPackage($this);
     $items['attribute_types'] = AttributeType::getListByPackage($this);
     $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this);
     $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this);
     $items['jobs'] = Job::getListByPackage($this);
     $items['workflow_types'] = WorkflowType::getListByPackage($this);
     ksort($items);
     return $items;
 }
Exemplo n.º 6
0
 protected function installPermissionsAndWorkflow()
 {
     $sx = simplexml_load_file(DIR_BASE_CORE . '/config/install/base/permissions.xml');
     foreach ($sx->permissioncategories->category as $pkc) {
         $handle = (string) $pkc['handle'];
         $pkca = PermissionKeyCategory::getByHandle($handle);
         if (!is_object($pkca)) {
             $pkx = PermissionKeyCategory::add((string) $pkc['handle']);
         }
     }
     foreach ($sx->workflowprogresscategories->category as $pkc) {
         $handle = (string) $pkc['handle'];
         $pkca = WorkflowProgressCategory::getByHandle($handle);
         if (!is_object($pkca)) {
             $pkx = WorkflowProgressCategory::add((string) $pkc['handle']);
         }
     }
     foreach ($sx->workflowtypes->workflowtype as $wt) {
         $handle = (string) $wt['handle'];
         $name = (string) $wt['name'];
         $wtt = WorkflowType::getByHandle($handle);
         if (!is_object($wtt)) {
             $pkx = WorkflowType::add($handle, $name);
         }
     }
     if (isset($sx->permissionaccessentitytypes)) {
         foreach ($sx->permissionaccessentitytypes->permissionaccessentitytype as $pt) {
             $name = $pt['name'];
             if (!$name) {
                 $name = Loader::helper('text')->unhandle($pt['handle']);
             }
             $handle = (string) $pt['handle'];
             $patt = PermissionAccessEntityType::getByHandle($handle);
             if (!is_object($patt)) {
                 $type = PermissionAccessEntityType::add((string) $pt['handle'], $name);
                 if (isset($pt->categories)) {
                     foreach ($pt->categories->children() as $cat) {
                         $catobj = PermissionKeyCategory::getByHandle((string) $cat['handle']);
                         $catobj->associateAccessEntityType($type);
                     }
                 }
             }
         }
     }
     $txt = Loader::helper('text');
     foreach ($sx->permissionkeys->permissionkey as $pk) {
         $pkc = PermissionKeyCategory::getByHandle((string) $pk['category']);
         $className = $txt->camelcase($pkc->getPermissionKeyCategoryHandle());
         $c1 = $className . 'PermissionKey';
         $handle = (string) $pk['handle'];
         $pka = PermissionKey::getByHandle($handle);
         if (!is_object($pka)) {
             $pkx = call_user_func(array($c1, 'import'), $pk);
         }
     }
 }
Exemplo n.º 7
0
 public function uninstall()
 {
     $type = PermissionAccessEntityType::getByHandle('parent_page_owner');
     $type->delete();
     parent::uninstall();
 }
Exemplo n.º 8
0
 public static function add($petHandle, $petName, $pkg = false)
 {
     $pkgID = 0;
     if (is_object($pkg)) {
         $pkgID = $pkg->getPackageID();
     }
     $db = Loader::db();
     $db->Execute('insert into PermissionAccessEntityTypes (petHandle, petName, pkgID) values (?, ?, ?)', array($petHandle, $petName, $pkgID));
     $id = $db->Insert_ID();
     $est = PermissionAccessEntityType::getByID($id);
     return $est;
 }
Exemplo n.º 9
0
 public function associateAccessEntityType(PermissionAccessEntityType $pt)
 {
     $db = Loader::db();
     $db->Execute('insert into PermissionAccessEntityTypeCategories (petID, pkCategoryID) values (?, ?)', array($pt->getAccessEntityTypeID(), $this->pkCategoryID));
 }
Exemplo n.º 10
0
?>
</div><? } ?></div>

<? if (!is_object($pae)) { ?>

<div class="btn-group">
	<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
	<i class="icon-plus-sign" /> <?php 
echo t('Select');
?>
	<span class="caret"></span>
		</a>
	<ul class="dropdown-menu">
	<? 
	$category = PermissionKeyCategory::getByHandle($_REQUEST['pkCategoryHandle']);
	$entitytypes = PermissionAccessEntityType::getList($category);
	foreach($entitytypes as $type) { ?>
		<li><?php 
echo $type->getAccessEntityTypeLinkHTML();
?>
</li>
	<? } ?>
	</ul>
</div>
<br/><br/>

<? foreach($entitytypes as $type) { ?>
	
<? if ($type->getPackageID() > 0) { ?>
	<? Loader::packageElement('permission/access/entity/types/' . $type->getAccessEntityTypeHandle(), $type->getPackageHandle(), array('type' => $type)); ?>
<? } else { ?>
Exemplo n.º 11
0
	protected function importPermissionAccessEntityTypes(SimpleXMLElement $sx) {
		if (isset($sx->permissionaccessentitytypes)) {
			foreach($sx->permissionaccessentitytypes->permissionaccessentitytype as $pt) {
				$pkg = ContentImporter::getPackageObject($pt['package']);
				$name = $pt['name'];
				if (!$name) {
					$name = Loader::helper('text')->unhandle($pt['handle']);
				}
				$type = PermissionAccessEntityType::add($pt['handle'], $name, $pkg);
				if (isset($pt->categories)) {
					foreach($pt->categories->children() as $cat) {
						$catobj = PermissionKeyCategory::getByHandle((string) $cat['handle']);
						$catobj->associateAccessEntityType($type);
					}
				}
			}
		}
	}
Exemplo n.º 12
0
<?

defined('C5_EXECUTE') or die("Access Denied.");

$type = PermissionAccessEntityType::getByHandle('group_set');
$url = $type->getAccessEntityTypeToolsURL();

$tp = new TaskPermission();
if (!$tp->canAccessGroupSearch()) { 
	echo(t("You have no access to groups."));
} else { 	

	if ($_REQUEST['filter'] == 'assign') { 
		$pk = PermissionKey::getByHandle('assign_user_groups');
		if (!$pk->validate()) {
			die(t('You have no access to assign groups.'));
		}
	}
	

	$gl = new GroupSetList();
	?>
	<div id="ccm-list-wrapper">
	
	<? if ($gl->getTotal() > 0) { 
	
		foreach ($gl->get() as $gs) { ?>
	
		<div class="ccm-group">
			<div style="background-image: url(<?php 
echo ASSETS_URL_IMAGES;
Exemplo n.º 13
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$tp = new TaskPermission();
$dt = Loader::helper('form/date_time');
if (!$tp->canAccessGroupSearch()) {
    die(t("You do not have group search permissions."));
}
$type = PermissionAccessEntityType::getByHandle('group_combination');
$url = $type->getAccessEntityTypeToolsURL();
?>

<div class="ccm-ui">

<form method="post" action="<?php 
echo $url;
?>
" id="ccm-permission-access-entity-combination-groups-form">

<p><?php 
echo t('Only users who are members of ALL selected groups will be eligible for this permission.');
?>
</p>

<table id="ccm-permissions-access-entity-combination-groups" class="table table-bordered">
<tr>
	<th><div style="width: 16px"></div></th>
	<th width="100%"><?php 
echo t("Name");
?>
</th>