summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-15 20:11:40 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-15 20:11:40 +0100
commit5d332df4b29a25124fa4f67a0915e7f65b0edd1d (patch)
treea5888560cde7f23cb8c39fed1ed71f3aefbdaf2a
parent5634d9a70d7431c583d28fc7d6ca6880cfa04e72 (diff)
downloadliberty-5d332df4b29a25124fa4f67a0915e7f65b0edd1d.tar.gz
liberty-5d332df4b29a25124fa4f67a0915e7f65b0edd1d.tar.bz2
liberty-5d332df4b29a25124fa4f67a0915e7f65b0edd1d.zip
Remove unused group model code
-rwxr-xr-xadmin/admin_liberty_inc.php15
-rwxr-xr-xadmin/schema_inc.php10
-rwxr-xr-xcontent_permissions.php112
-rwxr-xr-xplugins/filter.htmlpurifier.php9
-rwxr-xr-xtemplates/content_permissions.tpl75
-rwxr-xr-xtemplates/service_content_icon_inc.tpl2
6 files changed, 8 insertions, 215 deletions
diff --git a/admin/admin_liberty_inc.php b/admin/admin_liberty_inc.php
index 164db17..4af85cc 100755
--- a/admin/admin_liberty_inc.php
+++ b/admin/admin_liberty_inc.php
@@ -33,17 +33,10 @@ if( $gBitSystem->isPackageActive( 'quota' )) {
];
}
-if( $gBitSystem->isPackageActive( 'protector' )) {
- $formLibertyFeatures['protector_single_role'] = [
- 'label' => 'Protector System Single role per content item',
- 'note' => 'Limit the protector system to asign a content item to a single role. The alternative allows content in multiple roles.',
- ];
-} elseif( $gBitSystem->isPackageActive( 'protector_group' )) {
- $formLibertyFeatures['protector_single_group'] = [
- 'label' => 'Protector System Single group per content item',
- 'note' => 'Limit the protector system to asign a content item to a single group. The alternative allows content in multiple groups.',
- ];
-}
+$formLibertyFeatures['protector_single_role'] = [
+ 'label' => 'Protector System Single role per content item',
+ 'note' => 'Limit the protector system to asign a content item to a single role. The alternative allows content in multiple roles.',
+];
$gBitSmarty->assign( 'formLibertyFeatures', $formLibertyFeatures );
$formLibertyTextareaFeatures = [
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index 55ceb25..e2462d5 100755
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -188,7 +188,7 @@ $tables = [
// CONSTRAINT ' , CONSTRAINT `liberty_process_queue` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` ) '
'liberty_content_permissions' => "
- group_id I4 PRIMARY,
+ role_id I4 PRIMARY,
perm_name C(30) PRIMARY,
content_id I4 PRIMARY,
is_revoked C(1)
@@ -220,14 +220,6 @@ $tables = [
];
-$tables['liberty_content_permissions'] =
-" role_id I4 PRIMARY,
- perm_name C(30) PRIMARY,
- content_id I4 PRIMARY,
- is_revoked C(1)
- CONSTRAINT ' , CONSTRAINT `liberty_content_id_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content` (`content_id`) '
-";
-
global $gBitInstaller;
foreach( array_keys( $tables ) AS $tableName ) {
diff --git a/content_permissions.php b/content_permissions.php
deleted file mode 100755
index 4eeb56c..0000000
--- a/content_permissions.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * @version $Revision$
- * @package liberty
- * @subpackage functions
- */
-
-/**
- * bit setup
- */
-
-use Bitweaver\BitBase;
-use Bitweaver\HttpStatusCodes;
-use Bitweaver\KernelTools;
-
-require_once '../kernel/includes/setup_inc.php';
-
-$gBitSystem->verifyPermission( 'p_liberty_assign_content_perms' );
-
-require_once LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php';
-
-if( $gContent == null ) {
- $gBitSystem->fatalError('Could not find the requested content.', null, null, HttpStatusCodes::HTTP_GONE );
-}
-
-// Process the form
-// send the user to the content page if he wants to
-if( !empty( $_REQUEST['back'] )) {
- KernelTools::bit_redirect( $gContent->getDisplayUrl() );
-}
-
-// Update database if needed
-if( !empty( $_REQUEST['action'] ) && BitBase::verifyId( $gContent->mContentId )) {
- if( $_REQUEST["action"] == 'expunge' ) {
- if( $gContent->expungeContentPermissions() ) {
- $feedback['success'] = KernelTools::tra( 'The content permissions were successfully removed.' );
- } else {
- $feedback['error'] = KernelTools::tra( 'The content permissions were not removed.' );
- }
- }
-
- if( BitBase::verifyId( $_REQUEST["group_id"] ?? 0 ) && !empty( $_REQUEST["perm"] )) {
- $gBitUser->verifyTicket();
- if( $_REQUEST["action"] == 'assign' ) {
- $gContent->storePermission( $_REQUEST["group_id"], $_REQUEST["perm"] );
- } elseif( $_REQUEST["action"] == 'negate' ) {
- $gContent->storePermission( $_REQUEST["group_id"], $_REQUEST["perm"], true );
- } elseif( $_REQUEST["action"] == 'remove' ) {
- $gContent->removePermission( $_REQUEST["group_id"], $_REQUEST["perm"] );
- }
- }
-}
-
-// Get a list of groups
-$listHash = [ 'sort_mode' => 'group_id_asc', 'visible' => 1 ];
-$contentPerms['groups'] = $gBitUser->getAllGroups( $listHash );
-
-$contentPerms['assignable'] = !empty( $gContent->mType['handler_package'] )
- ? $gBitUser->getGroupPermissions( [ 'package' => $gContent->mType['handler_package'] ] )
- // this is a last resort and will dump all perms a user has
- : $gBitUser->mPerms;
-
-// Now we have to get the individual object permissions if any
-if( $contentPerms['assigned'] = $gContent->getContentPermissionsList() ) {
- // merge assigned permissions with group permissions
- foreach( array_keys( $contentPerms['groups'] ) as $groupId ) {
- if( !empty( $contentPerms['assigned'][$groupId] )) {
- $contentPerms['groups'][$groupId]['perms'] = array_merge( $contentPerms['groups'][$groupId]['perms'], $contentPerms['assigned'][$groupId] );
- }
- }
-}
-$gBitSmarty->assign( 'contentPerms', $contentPerms );
-
-// if we've called this page as part of an ajax update, we output the appropriate data
-if( $gBitThemes->isAjaxRequest() ) {
- $size = \count( $contentPerms['roles'] ) <= 10 ? 'large/' : 'small/';
-
- $gid = $_REQUEST['group_id'];
- $perm = $_REQUEST['perm'];
-
- // we're applying the same logic as in the template. if you fix / change anything here, please update the template as well.
- $biticon = [
- 'ipackage' => 'icons',
- 'iname' => "{$size}media-playback-stop",
- 'iexplain' => '',
- 'iforce' => 'icon',
- ];
- $action = 'assign';
- if( !empty( $contentPerms['groups'][$gid]['perms'][$perm] )) {
- $biticon['iname'] = $size.'dialog-ok';
- if( !empty( $contentPerms['assigned'][$gid][$perm] )) {
- $assigned = $contentPerms['assigned'][$gid][$perm];
- $biticon['iname'] = $size.'list-add';
- $action = 'negate';
- }
- if( !empty( $assigned['is_revoked'] )) {
- $biticon['iname'] = $size.'list-remove';
- $action = 'remove';
- }
- }
-
- $ret = '<a title="'.$contentPerms['groups'][$gid]['group_name']." :: ".$perm.'" '.
- 'href="javascript:void(0);" onclick="BitAjax.updater('.
- "'{$perm}{$gid}', ".
- "'".LIBERTY_PKG_URL."content_permissions.php', ".
- "'action={$action}&amp;content_id={$gContent->mContentId}&amp;perm={$perm}&amp;group_id={$gid}'".
- ')">'.$gBitweaverExtension->smarty_function_biticon( $biticon, $gBitSmarty ).'</a>';
- echo $ret;
- die;
-}
-
-$gBitSystem->display( 'bitpackage:liberty/content_permissions.tpl', KernelTools::tra( 'Content Permissions' ), [ 'display_mode' => 'display' ]); \ No newline at end of file
diff --git a/plugins/filter.htmlpurifier.php b/plugins/filter.htmlpurifier.php
index 600fbf9..1c74646 100755
--- a/plugins/filter.htmlpurifier.php
+++ b/plugins/filter.htmlpurifier.php
@@ -158,15 +158,10 @@ function htmlpure_getDefaultConfig( &$htmlp_version, $pObject=null ){
$hasAdmin = false;
if( is_a( $pObject, 'LibertyContent' ) ) {
// check to see if last editor has ability to admin content, if so, ease up on the purification restraints
- $query = $gBitSystem->isPackageActive( 'protector' )
- ? "SELECT urp.`role_id`
+ $query = "SELECT urp.`role_id`
FROM `".BIT_DB_PREFIX."users_roles_map` urm
INNER JOIN `".BIT_DB_PREFIX."users_role_permissions` urp ON (urp.`role_id`=urm.`role_id`)
- WHERE urm.`user_id`=? AND (urp.`perm_name`=? OR urp.`perm_name`='p_admin')"
- : "SELECT ugp.`group_id`
- FROM `".BIT_DB_PREFIX."users_groups_map` ugm
- INNER JOIN `".BIT_DB_PREFIX."users_group_permissions` ugp ON (ugp.`group_id`=ugm.`group_id`)
- WHERE ugm.`user_id`=? AND (ugp.`perm_name`=? OR ugp.`perm_name`='p_admin')";
+ WHERE urm.`user_id`=? AND (urp.`perm_name`=? OR urp.`perm_name`='p_admin')";
// cache for 15 minutes
$hasAdmin = $pObject->mDb->getOne( $query, [ $pObject->getField( 'modifier_user_id' ), $pObject->mAdminContentPerm ], null, null, 900 );
}
diff --git a/templates/content_permissions.tpl b/templates/content_permissions.tpl
deleted file mode 100755
index 4120bac..0000000
--- a/templates/content_permissions.tpl
+++ /dev/null
@@ -1,75 +0,0 @@
-<div class="admin liberty">
- <div class="header">
- <h1>{tr}Assign permissions{/tr}</h1>
- </div>
-
- <div class="body">
- <h2>{tr}Assign permissions to{/tr}: {$gContent->getTitle()}</h2>
-
- {if !$contentPerms.assigned}
- {formfeedback warning="No Individual permissions set. Global Permissions apply."}
- {/if}
-
- {if $contentPerms.assigned || $gBitThemes->isJavascriptEnabled()}
- {smartlink ititle="Clear all custom content permissions" action=expunge content_id=$gContent->mContentId}
- {/if}
-
- {if count($contentPerms.groups) <= 10}
- {assign var=size value="large/"}
- {/if}
-
- <table class="table data">
- <caption>{tr}Permissions set for this content item{/tr}</caption>
- <tr>
- <th>{tr}Permission{/tr}</th>
- {foreach from=$contentPerms.groups item=group}
- <th onmouseover="BitBase.showById('f{$group.group_id}');BitBase.hideById('a{$group.group_id}')">
- <abbr id="a{$group.group_id}" title="{$group.group_name}">{if count($contentPerms.groups) gt 10}{$group.group_name|truncate:4:false}{else}{$group.group_name}{/if}</abbr>
- <span id="f{$group.group_id}" style="display:none">{$group.group_name}</span>
- </th>
- {/foreach}
- </tr>
-
- {foreach from=$contentPerms.assignable key=perm item=permInfo name=perms}
- <tr class="{cycle values="odd,even"}">
- <td>{$permInfo.perm_desc}{if $gBitUser->isAdmin()}<br /><em>({$permInfo.perm_name})</em>{/if}</td>
- {foreach from=$contentPerms.groups key=groupId item=groupInfo}
- {assign var=icon value="media-playback-stop"} {* default icon *}
- {assign var=action value="assign"} {* default action *}
- {if $groupInfo.perms.$perm} {* global active permissions *}
- {assign var=icon value="dialog-ok"} {* default active permission icon *}
- {if $contentPerms.assigned.$groupId.$perm.is_revoked}
- {assign var=icon value="list-remove"} {* is_revoked icon *}
- {assign var=action value="remove"} {* remove permission if we have a custom one *}
- {elseif $contentPerms.assigned.$groupId.$perm}
- {assign var=icon value="list-add"} {* custon permission icon *}
- {assign var=action value="negate"} {* remove permission if we have a custom one *}
- {/if}
- {/if}
-
- <td style="text-align:center">
- {if $gBitThemes->isJavascriptEnabled()}
- <span id="{$perm}{$groupId}">
- <a title="{$contentPerms.groups.$groupId.group_name} :: {$perm}" href="javascript:void(0);" onclick="BitAjax.updater('{$perm}{$groupId}', '{$smarty.const.LIBERTY_PKG_URL}content_permissions.php', 'action={$action}&amp;content_id={$gContent->mContentId}&amp;perm={$perm}&amp;group_id={$groupId}')">
- {biticon iname="$size$icon" iexplain=$icon}
- </a>
- </span>
- {else}
- {smartlink itra=false ititle="$contentPerms.groups.$groupId.group_name :: $perm" ibiticon="$size$icon" action=$action content_id=$gContent->mContentId perm=$perm group_id=$groupId}
- {/if}
- </td>
- {/foreach}
- </tr>
- {/foreach}
- </table>
-
- <h2>{tr}Legend{/tr}</h2>
-
- <dl>
- <dt>{booticon iname="fa-circle-plus"} Custom Permission: Always Allow</dt>
- <dt>{booticon iname="fa-circle-minus"} Custom Permission: Always Deny</dt>
- <dt>{booticon iname="fa-check"} Global Permission: Allow</dt>
- <dt>{biticon iname="media-playback-stop" iexplain=""} Global Permission: Deny</dt>
- </dl>
- </div><!-- end .body -->
-</div><!-- end .liberty -->
diff --git a/templates/service_content_icon_inc.tpl b/templates/service_content_icon_inc.tpl
index 04cd0f8..744fde7 100755
--- a/templates/service_content_icon_inc.tpl
+++ b/templates/service_content_icon_inc.tpl
@@ -17,7 +17,7 @@
{else}
{assign var=iconClass value=""}
{/if}
- {smartlink ipackage=liberty ifile="content_role_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass ipackage=liberty ifile="content_permissions.php" content_id=$serviceHash.content_id}
+ {smartlink ipackage=liberty ifile="content_role_permissions.php" ititle="Assign Permissions" booticon="icon-key" class=$iconClass content_id=$serviceHash.content_id}
{/if}
{/if}
{/strip}