mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:55:19 +00:00
DB migration for search_stream permission
This commit is contained in:
parent
4b9d53e44f
commit
e3ed20c49e
2 changed files with 40 additions and 2 deletions
39
Code/Update/_1266.php
Normal file
39
Code/Update/_1266.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Code\Update;
|
||||||
|
|
||||||
|
use Code\Lib\AbConfig;
|
||||||
|
use Code\Lib\PConfig;
|
||||||
|
|
||||||
|
class _1266
|
||||||
|
{
|
||||||
|
|
||||||
|
// This update adds the 'search_stream' permission to existing connections.
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$r = q("SELECT * from channel where true");
|
||||||
|
if ($r) {
|
||||||
|
foreach ($r as $rv) {
|
||||||
|
PConfig::Set($rv['channel_id'], 'perm_limits', 'search_stream', PERMS_SPECIFIC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$r = q("SELECT * from abook where abook_self = 0");
|
||||||
|
if ($r) {
|
||||||
|
foreach ($r as $rv) {
|
||||||
|
$perms = AbConfig::Get($rv['abook_channel'], $rv['abook_xchan'], 'system', 'my_perms', [] );
|
||||||
|
$s = explode(',', $perms);
|
||||||
|
if (in_array('view_stream', $s) && (! in_array('search_stream', $s))) {
|
||||||
|
$s[] = 'search_stream';
|
||||||
|
}
|
||||||
|
AbConfig::Set($rv['abook_channel'], $rv['abook_xchan'], 'system', 'my_perms', implode(',', $s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verify()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
3
boot.php
3
boot.php
|
@ -24,9 +24,8 @@ use Code\Lib\Url;
|
||||||
* @brief This file defines some global constants and includes the central App class.
|
* @brief This file defines some global constants and includes the central App class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
const REPOSITORY_ID = 'streams';
|
const REPOSITORY_ID = 'streams';
|
||||||
const DB_UPDATE_VERSION = 1265;
|
const DB_UPDATE_VERSION = 1266;
|
||||||
const PROJECT_BASE = __DIR__;
|
const PROJECT_BASE = __DIR__;
|
||||||
const ACTIVITYPUB_ENABLED = true;
|
const ACTIVITYPUB_ENABLED = true;
|
||||||
const NOMAD_PROTOCOL_VERSION = '11.0';
|
const NOMAD_PROTOCOL_VERSION = '11.0';
|
||||||
|
|
Loading…
Reference in a new issue