Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Permissions management
|
||||
* Last Updated: $Date: 2010-10-21 07:08:38 -0400 (Thu, 21 Oct 2010) $
|
||||
* Last Updated: $Date: 2011-09-02 20:55:33 -0400 (Fri, 02 Sep 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Revision: 7007 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Revision: 9450 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
@@ -30,27 +30,27 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
*
|
||||
* @var object Skin templates
|
||||
*/
|
||||
private $html;
|
||||
protected $html;
|
||||
|
||||
/**
|
||||
* Shortcut for url
|
||||
*
|
||||
* @var string URL shortcut
|
||||
*/
|
||||
private $form_code;
|
||||
protected $form_code;
|
||||
|
||||
/**
|
||||
* Shortcut for url (javascript)
|
||||
*
|
||||
* @var string JS URL shortcut
|
||||
*/
|
||||
private $form_code_js;
|
||||
protected $form_code_js;
|
||||
|
||||
/**
|
||||
* Main class entry point
|
||||
*
|
||||
* @param object ipsRegistry reference
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
public function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
@@ -86,12 +86,12 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
break;
|
||||
|
||||
case 'view_perm_users':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_view' );
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'perms_manage' );
|
||||
$this->permissionSetUsers();
|
||||
break;
|
||||
|
||||
case 'remove_mask':
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'permmasks_delete' );
|
||||
$this->registry->getClass('class_permissions')->checkPermissionAutoMsg( 'perms_manage' );
|
||||
$this->removePermissionSet();
|
||||
break;
|
||||
|
||||
@@ -111,7 +111,7 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
/**
|
||||
* Removes permission set(s) from a user
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function removePermissionSet()
|
||||
{
|
||||
@@ -170,7 +170,7 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
/**
|
||||
* Show users that are assigned the specified permission set
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function permissionSetUsers()
|
||||
{
|
||||
@@ -260,9 +260,9 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
/**
|
||||
* Deletes a permission set
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _doDeleteSet()
|
||||
protected function _doDeleteSet()
|
||||
{
|
||||
/* INIT */
|
||||
$id = $this->request['id'];
|
||||
@@ -279,11 +279,11 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
/* Check to see if there is a permission map */
|
||||
$_file = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/coreExtensions.php';
|
||||
|
||||
if( file_exists( $_file ) )
|
||||
if( is_file( $_file ) )
|
||||
{
|
||||
/* Get the permission mappings */
|
||||
$_PERM_CONFIG = array();
|
||||
require_once( $_file );
|
||||
require_once( $_file );/*noLibHook*/
|
||||
|
||||
/* Check for a config array */
|
||||
if( is_array( $_PERM_CONFIG ) && count( $_PERM_CONFIG ) )
|
||||
@@ -327,18 +327,22 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
}
|
||||
|
||||
/* Delete */
|
||||
$this->DB->delete( 'forum_perms', "perm_id=$id" );
|
||||
$this->DB->delete( 'forum_perms', "perm_id=" . $id );
|
||||
|
||||
/* Fire callbacks */
|
||||
$this->_fireAppCallbacks();
|
||||
|
||||
/* Done */
|
||||
$this->registry->output->doneScreen( $this->lang->words['per_removed'], $this->lang->words['per_manage'], $this->form_code, 'redirect' );
|
||||
$this->registry->output->global_message = $this->lang->words['per_removed'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a nwe permission set
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _doCreatePermissionSet()
|
||||
protected function _doCreatePermissionSet()
|
||||
{
|
||||
/* INIT */
|
||||
$set_name = $this->request['new_perm_name'];
|
||||
@@ -363,11 +367,11 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
/* Check to see if there is a permission map */
|
||||
$_file = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/coreExtensions.php';
|
||||
|
||||
if( file_exists( $_file ) )
|
||||
if( is_file( $_file ) )
|
||||
{
|
||||
/* Get the permission mappings */
|
||||
$_PERM_CONFIG = array();
|
||||
require_once( $_file );
|
||||
require_once( $_file );/*noLibHook*/
|
||||
|
||||
/* Check for a config array */
|
||||
if( is_array( $_PERM_CONFIG ) && count( $_PERM_CONFIG ) )
|
||||
@@ -412,16 +416,20 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
$this->DB->update( 'permission_index', $r, "perm_id=" . $perm_id );
|
||||
}
|
||||
|
||||
/* Fire callbacks */
|
||||
$this->_fireAppCallbacks();
|
||||
|
||||
/* Done */
|
||||
$this->registry->output->doneScreen( $this->lang->words['per_saved'], $this->lang->words['per_manage'], $this->form_code . 'do=edit_set_form&id=' . $new_set_id, 'redirect' );
|
||||
$this->registry->output->global_message = $this->lang->words['per_saved'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . 'do=edit_set_form&id=' . $new_set_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the global permission set form
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _permissionSaveForm()
|
||||
protected function _permissionSaveForm()
|
||||
{
|
||||
/* ID */
|
||||
$id = intval( $this->request['id'] );
|
||||
@@ -442,16 +450,20 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
$this->DB->update( 'forum_perms', array( 'perm_name' => $this->request['perm_name'] ), "perm_id={$id}" );
|
||||
}
|
||||
|
||||
/* Fire callbacks */
|
||||
$this->_fireAppCallbacks();
|
||||
|
||||
/* Done */
|
||||
$this->registry->output->doneScreen( $this->lang->words['per_saved'], $this->lang->words['per_manage'], $this->form_code . '&_from=' . $this->request['_from'], 'redirect' );
|
||||
$this->registry->output->global_message = $this->lang->words['per_saved'];
|
||||
$this->registry->output->silentRedirectWithMessage( $this->settings['base_url'] . $this->form_code . '&_from=' . $this->request['_from'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Form for modifying a permission set
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _permissionSetForm()
|
||||
protected function _permissionSetForm()
|
||||
{
|
||||
/* ID */
|
||||
$id = intval( $this->request['id'] );
|
||||
@@ -471,11 +483,11 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
/* Check to see if there is a permission map */
|
||||
$_file = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/coreExtensions.php';
|
||||
|
||||
if( file_exists( $_file ) )
|
||||
if( is_file( $_file ) )
|
||||
{
|
||||
/* Get the permission mappings */
|
||||
$_PERM_CONFIG = array();
|
||||
require_once( $_file );
|
||||
require_once( $_file );/*noLibHook*/
|
||||
|
||||
/* Check for a config array */
|
||||
if( is_array( $_PERM_CONFIG ) && count( $_PERM_CONFIG ) )
|
||||
@@ -484,18 +496,19 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
foreach( $_PERM_CONFIG as $perm_type )
|
||||
{
|
||||
/* Check for a class */
|
||||
$_class = $app['app_directory'] . 'PermMapping' . $perm_type;
|
||||
|
||||
if( class_exists( $_class ) )
|
||||
$classToLoad = IPSLib::loadLibrary( '', $app['app_directory'] . 'PermMapping' . $perm_type, $app['app_directory'] );
|
||||
|
||||
if( class_exists( $classToLoad ) )
|
||||
{
|
||||
/* Create the object */
|
||||
$perm_map = new $_class;
|
||||
$perm_map = new $classToLoad;
|
||||
|
||||
/* Make sure the function exists */
|
||||
if( method_exists( $perm_map, 'getPermItems' ) )
|
||||
{
|
||||
$matricies[$app['app_title']] = $perm_obj->adminItemPermMatrix( $perm_map, $perm_map->getPermItems(), $id, $app['app_directory'], $perm_type );
|
||||
$apps[$app['app_directory']] = $perm_type;
|
||||
$_key = count($_PERM_CONFIG) > 1 ? $app['app_title'] . ' ' . $perm_type : $app['app_title'];
|
||||
$matricies[ $_key ] = $perm_obj->adminItemPermMatrix( $perm_map, $perm_map->getPermItems(), $id, $app['app_directory'], $perm_type );
|
||||
$apps[$app['app_directory']][ $perm_type ] = $perm_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,9 +523,9 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
/**
|
||||
* List permission masks
|
||||
*
|
||||
* @return void [Outputs to screen]
|
||||
* @return @e void [Outputs to screen]
|
||||
*/
|
||||
private function _mainScreen()
|
||||
protected function _mainScreen()
|
||||
{
|
||||
/* INIT */
|
||||
$perms = array();
|
||||
@@ -598,7 +611,7 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
$groups_used = "{$this->lang->words['per_none']}";
|
||||
}
|
||||
|
||||
if ( isset($mems[ $id ]) AND $mems[ $id ] > 0 )
|
||||
if ( !empty($mems[ $id ]) )
|
||||
{
|
||||
$is_active = 1;
|
||||
}
|
||||
@@ -628,4 +641,35 @@ class admin_members_groups_permissions extends ipsCommand
|
||||
|
||||
$this->registry->output->html .= $this->html->permissionsSplash( $display_groups, $dlist );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire any application callbacks as needed
|
||||
*
|
||||
* @return @e void
|
||||
*/
|
||||
protected function _fireAppCallbacks()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Loop through each application
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $this->registry->getApplications() as $app )
|
||||
{
|
||||
// Let's skip the app_enabled check to be sure everything is always recached!
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for callback file
|
||||
//-----------------------------------------
|
||||
|
||||
$_file = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/permissionsSync.php';
|
||||
|
||||
if( is_file( $_file ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( $_file, $app['app_directory'] . 'PermissionsSync', $app['app_directory'] );
|
||||
$_callback = new $classToLoad( $this->registry );
|
||||
|
||||
$_callback->updatePermissions();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user