mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 16:35:19 +00:00
accesscontrol rename
This commit is contained in:
parent
c8714bf9c2
commit
f25a48c54a
17 changed files with 39 additions and 39 deletions
|
@ -3,16 +3,16 @@
|
|||
namespace Zotlabs\Access;
|
||||
|
||||
/**
|
||||
* @brief AccessList class which represents individual content ACLs.
|
||||
* @brief AccessControl class which represents individual content ACLs.
|
||||
*
|
||||
* A class to hold an AccessList object with allowed and denied contacts and
|
||||
* A class to hold an AccessControl object with allowed and denied contacts and
|
||||
* groups.
|
||||
*
|
||||
* After evaluating @ref ::Zotlabs::Access::PermissionLimits "PermissionLimits"
|
||||
* and @ref ::Zotlabs::Lib::Permcat "Permcat"s individual content ACLs are evaluated.
|
||||
* These answer the question "Can Joe view *this* album/photo?".
|
||||
*/
|
||||
class AccessList {
|
||||
class AccessControl {
|
||||
/**
|
||||
* @brief Allow contacts
|
||||
* @var string
|
|
@ -6,7 +6,7 @@ use App;
|
|||
use Zotlabs\Lib\Apps;
|
||||
use Zotlabs\Web\Controller;
|
||||
use Zotlabs\Lib\Chatroom;
|
||||
use Zotlabs\Access\AccessList;
|
||||
use Zotlabs\Access\AccessControl;
|
||||
|
||||
use Zotlabs\Lib\Libsync;
|
||||
|
||||
|
@ -66,7 +66,7 @@ class Chat extends Controller {
|
|||
goaway(z_root() . '/chat/' . $channel['channel_address']);
|
||||
}
|
||||
|
||||
$acl = new AccessList($channel);
|
||||
$acl = new AccessControl($channel);
|
||||
$acl->set_from_array($_REQUEST);
|
||||
|
||||
$arr = $acl->get();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\Activity;
|
||||
use Zotlabs\Access\AccessList;
|
||||
use Zotlabs\Access\AccessControl;
|
||||
|
||||
/*
|
||||
@file cover_photo.php
|
||||
|
@ -290,7 +290,7 @@ logger('gis: ' . print_r($gis,true));
|
|||
'actor' => Activity::encode_person($channel,false),
|
||||
];
|
||||
|
||||
$acl = new AccessList($channel);
|
||||
$acl = new AccessControl($channel);
|
||||
$x = $acl->get();
|
||||
$arr['allow_cid'] = $x['allow_cid'];
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ class Events extends \Zotlabs\Web\Controller {
|
|||
|
||||
$channel = \App::get_channel();
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList(false);
|
||||
$acl = new \Zotlabs\Access\AccessControl(false);
|
||||
|
||||
if($event_id) {
|
||||
$x = q("select * from event where id = %d and uid = %d limit 1",
|
||||
|
@ -444,7 +444,7 @@ class Events extends \Zotlabs\Web\Controller {
|
|||
|
||||
require_once('include/acl_selectors.php');
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
$perm_defaults = $acl->get();
|
||||
|
||||
$permissions = ((x($orig_event)) ? $orig_event : $perm_defaults);
|
||||
|
|
|
@ -30,7 +30,7 @@ class Filestorage extends \Zotlabs\Web\Controller {
|
|||
|
||||
$channel = \App::get_channel();
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
$acl->set_from_array($_POST);
|
||||
$x = $acl->get();
|
||||
|
||||
|
|
|
@ -572,7 +572,7 @@ class Item extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
|
||||
$view_policy = \Zotlabs\Access\PermissionLimits::Get($channel['channel_id'],'view_stream');
|
||||
$comment_policy = \Zotlabs\Access\PermissionLimits::Get($channel['channel_id'],'post_comments');
|
||||
|
|
|
@ -145,7 +145,7 @@ class Mitem extends \Zotlabs\Web\Controller {
|
|||
$menu_names[] = $menus['menu_name'];
|
||||
}
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
|
||||
$lockstate = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock');
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Zotlabs\Module;
|
|||
use App;
|
||||
use Zotlabs\Lib\Libsync;
|
||||
use Zotlabs\Lib\PermissionDescription;
|
||||
use Zotlabs\Access\AccessList;
|
||||
use Zotlabs\Access\AccessControl;
|
||||
|
||||
require_once('include/photo/photo_driver.php');
|
||||
require_once('include/photos.php');
|
||||
|
@ -81,7 +81,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
|
||||
$owner_record = $s[0];
|
||||
|
||||
$acl = new AccessList(App::$data['channel']);
|
||||
$acl = new AccessControl(App::$data['channel']);
|
||||
|
||||
if((argc() > 3) && (argv(2) === 'album')) {
|
||||
|
||||
|
@ -557,7 +557,7 @@ class Photos extends \Zotlabs\Web\Controller {
|
|||
if($_is_owner) {
|
||||
$channel = App::get_channel();
|
||||
|
||||
$acl = new AccessList($channel);
|
||||
$acl = new AccessControl($channel);
|
||||
$channel_acl = $acl->get();
|
||||
|
||||
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
||||
|
|
|
@ -101,7 +101,7 @@ class Rpost extends \Zotlabs\Web\Controller {
|
|||
$channel = \App::get_channel();
|
||||
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
|
||||
$channel_acl = $acl->get();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class Channel {
|
|||
foreach($global_perms as $k => $v) {
|
||||
\Zotlabs\Access\PermissionLimits::Set(local_channel(),$k,intval($_POST[$k]));
|
||||
}
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
$acl->set_from_array($_POST);
|
||||
$x = $acl->get();
|
||||
|
||||
|
@ -465,7 +465,7 @@ class Channel {
|
|||
|
||||
$stpl = get_markup_template('settings.tpl');
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
$perm_defaults = $acl->get();
|
||||
|
||||
$group_select = AccessList::select(local_channel(),$channel['channel_default_group']);
|
||||
|
|
|
@ -76,7 +76,7 @@ class Thing extends \Zotlabs\Web\Controller {
|
|||
if((! $name) || (! $translated_verb))
|
||||
return;
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
|
||||
if(array_key_exists('contact_allow',$_REQUEST)
|
||||
|| array_key_exists('group_allow',$_REQUEST)
|
||||
|
@ -283,7 +283,7 @@ class Thing extends \Zotlabs\Web\Controller {
|
|||
return;
|
||||
}
|
||||
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
$channel_acl = $acl->get();
|
||||
|
||||
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
||||
|
|
|
@ -338,7 +338,7 @@ class Browser extends DAV\Browser\Plugin {
|
|||
if($this->auth->owner_id) {
|
||||
$channel = channelx_by_n($this->auth->owner_id);
|
||||
if($channel) {
|
||||
$acl = new \Zotlabs\Access\AccessList($channel);
|
||||
$acl = new \Zotlabs\Access\AccessControl($channel);
|
||||
$channel_acl = $acl->get();
|
||||
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ function event_addtocal($item_id, $uid) {
|
|||
if($ev->private)
|
||||
$ev['allow_cid'] = '<' . $channel['channel_hash'] . '>';
|
||||
else {
|
||||
$acl = new Zotlabs\Access\AccessList($channel);
|
||||
$acl = new Zotlabs\Access\AccessControl($channel);
|
||||
$x = $acl->get();
|
||||
$ev['allow_cid'] = $x['allow_cid'];
|
||||
$ev['allow_gid'] = $x['allow_gid'];
|
||||
|
|
|
@ -19,7 +19,7 @@ use Zotlabs\Lib\IConfig;
|
|||
use Zotlabs\Lib\PConfig;
|
||||
use Zotlabs\Lib\ThreadListener;
|
||||
use Zotlabs\Access\PermissionLimits;
|
||||
use Zotlabs\Access\AccessList as ZACL;
|
||||
use Zotlabs\Access\AccessControl;
|
||||
use Zotlabs\Daemon\Master;
|
||||
|
||||
|
||||
|
@ -4506,7 +4506,7 @@ function send_profile_photo_activity($channel,$photo,$profile) {
|
|||
'actor' => Activity::encode_person($channel,false),
|
||||
];
|
||||
|
||||
$acl = new ZACL($channel);
|
||||
$acl = new AccessControl($channel);
|
||||
$x = $acl->get();
|
||||
$arr['allow_cid'] = $x['allow_cid'];
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ function menu_add_item($menu_id, $uid, $arr) {
|
|||
$channel = App::get_channel();
|
||||
}
|
||||
|
||||
$acl = new Zotlabs\Access\AccessList($channel);
|
||||
$acl = new Zotlabs\Access\AccessControl($channel);
|
||||
$acl->set_from_array($arr);
|
||||
$p = $acl->get();
|
||||
|
||||
|
@ -353,7 +353,7 @@ function menu_edit_item($menu_id, $uid, $arr) {
|
|||
$channel = App::get_channel();
|
||||
}
|
||||
|
||||
$acl = new Zotlabs\Access\AccessList($channel);
|
||||
$acl = new Zotlabs\Access\AccessControl($channel);
|
||||
$acl->set_from_array($arr);
|
||||
$p = $acl->get();
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ function photo_upload($channel, $observer, $args) {
|
|||
// all other settings. 'allow_cid' being passed from an external source takes priority over channel settings.
|
||||
// ...messy... needs re-factoring once the photos/files integration stabilises
|
||||
|
||||
$acl = new Zotlabs\Access\AccessList($channel);
|
||||
$acl = new Zotlabs\Access\AccessControl($channel);
|
||||
if(array_key_exists('directory',$args) && $args['directory'])
|
||||
$acl->set($args['directory']);
|
||||
if(array_key_exists('allow_cid',$args))
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
namespace Zotlabs\Tests\Unit\Access;
|
||||
|
||||
use Zotlabs\Tests\Unit\UnitTestCase;
|
||||
use Zotlabs\Access\AccessList;
|
||||
use Zotlabs\Access\AccessControl;
|
||||
|
||||
/**
|
||||
* @brief Unit Test case for AccessList class.
|
||||
*
|
||||
* @covers Zotlabs\Access\AccessList
|
||||
* @covers Zotlabs\Access\AccessControl
|
||||
*/
|
||||
class AccessListTest extends UnitTestCase {
|
||||
|
||||
|
@ -54,7 +54,7 @@ class AccessListTest extends UnitTestCase {
|
|||
'channel_deny_gid' => '<dgid><dgid2>'
|
||||
];
|
||||
|
||||
$accessList = new AccessList($channel);
|
||||
$accessList = new AccessControl($channel);
|
||||
|
||||
$this->assertEquals($this->expectedResult, $accessList->get());
|
||||
$this->assertFalse($accessList->get_explicit());
|
||||
|
@ -64,12 +64,12 @@ class AccessListTest extends UnitTestCase {
|
|||
* @expectedException PHPUnit\Framework\Error\Error
|
||||
*/
|
||||
public function testPHPErrorOnInvalidConstructor() {
|
||||
$accessList = new AccessList('invalid');
|
||||
$accessList = new AccessControl('invalid');
|
||||
// Causes: "Illegal string offset 'channel_allow_cid'"
|
||||
}
|
||||
|
||||
public function testDefaultGetExplicit() {
|
||||
$accessList = new AccessList([]);
|
||||
$accessList = new AccessControl([]);
|
||||
|
||||
$this->assertFalse($accessList->get_explicit());
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class AccessListTest extends UnitTestCase {
|
|||
'deny_gid' => ''
|
||||
];
|
||||
|
||||
$accessList = new AccessList([]);
|
||||
$accessList = new AccessControl([]);
|
||||
|
||||
$this->assertEquals($arr, $accessList->get());
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class AccessListTest extends UnitTestCase {
|
|||
'deny_cid' => '',
|
||||
'deny_gid' => '<dgid><dgid2>'
|
||||
];
|
||||
$accessList = new AccessList([]);
|
||||
$accessList = new AccessControl([]);
|
||||
|
||||
// default explicit true
|
||||
$accessList->set($arr);
|
||||
|
@ -113,7 +113,7 @@ class AccessListTest extends UnitTestCase {
|
|||
* @expectedException PHPUnit\Framework\Error\Error
|
||||
*/
|
||||
public function testPHPErrorOnInvalidSet() {
|
||||
$accessList = new AccessList([]);
|
||||
$accessList = new AccessControl([]);
|
||||
|
||||
$accessList->set('invalid');
|
||||
// Causes: "Illegal string offset 'allow_cid'"
|
||||
|
@ -133,7 +133,7 @@ class AccessListTest extends UnitTestCase {
|
|||
'contact_deny' => [],
|
||||
'group_deny' => ['dgid', 'dgid2']
|
||||
];
|
||||
$accessList = new AccessList([]);
|
||||
$accessList = new AccessControl([]);
|
||||
$accessList->set_from_array($arraySetFromArray);
|
||||
|
||||
$this->assertEquals($this->expectedResult, $accessList->get());
|
||||
|
@ -147,7 +147,7 @@ class AccessListTest extends UnitTestCase {
|
|||
'contact_deny' => '',
|
||||
'group_deny' => 'dgid, dgid2'
|
||||
];
|
||||
$accessList2 = new AccessList([]);
|
||||
$accessList2 = new AccessControl([]);
|
||||
$accessList2->set_from_array($stringSetFromArray, false);
|
||||
|
||||
$this->assertEquals($this->expectedResult, $accessList2->get());
|
||||
|
@ -158,10 +158,10 @@ class AccessListTest extends UnitTestCase {
|
|||
* @dataProvider isprivateProvider
|
||||
*/
|
||||
public function testIsPrivate($channel) {
|
||||
$accessListPublic = new AccessList([]);
|
||||
$accessListPublic = new AccessControl([]);
|
||||
$this->assertFalse($accessListPublic->is_private());
|
||||
|
||||
$accessListPrivate = new AccessList($channel);
|
||||
$accessListPrivate = new AccessControl($channel);
|
||||
$this->assertTrue($accessListPrivate->is_private());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue