Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120834638
RoomConfigTrait.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
RoomConfigTrait.php
View Options
<?php
namespace
App\Traits\Meet
;
trait
RoomConfigTrait
{
/**
* A helper to get the room configuration.
*/
public
function
getConfig
():
array
{
$settings
=
$this
->
getSettings
([
'password'
,
'locked'
,
'nomedia'
]);
$config
=
[
'acl'
=>
$this
->
getACL
(),
'locked'
=>
$settings
[
'locked'
]
===
'true'
,
'nomedia'
=>
$settings
[
'nomedia'
]
===
'true'
,
'password'
=>
$settings
[
'password'
],
];
return
$config
;
}
/**
* A helper to update room configuration.
*
* @param array $config An array of configuration options
*
* @return array A list of input validation error messages
*/
public
function
setConfig
(
array
$config
):
array
{
$errors
=
[];
foreach
(
$config
as
$key
=>
$value
)
{
if
(
$key
==
'password'
)
{
if
(
$value
===
null
||
$value
===
''
)
{
$value
=
null
;
}
else
{
// TODO: Do we have to validate the password in any way?
}
$this
->
setSetting
(
$key
,
$value
);
}
elseif
(
$key
==
'locked'
||
$key
==
'nomedia'
)
{
$this
->
setSetting
(
$key
,
$value
?
'true'
:
null
);
}
elseif
(
$key
==
'acl'
)
{
if
(!
empty
(
$value
)
&&
!
$this
->
hasSKU
(
'group-room'
))
{
$errors
[
$key
]
=
\trans
(
'validation.invalid-config-parameter'
);
continue
;
}
$acl_errors
=
$this
->
validateACL
(
$value
);
if
(
empty
(
$acl_errors
))
{
$this
->
setACL
(
$value
);
}
else
{
$errors
[
$key
]
=
$acl_errors
;
}
}
else
{
$errors
[
$key
]
=
\trans
(
'validation.invalid-config-parameter'
);
}
}
return
$errors
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 1:06 PM (6 d, 21 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18826449
Default Alt Text
RoomConfigTrait.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline