Merge pull request #12393 from annando/api-permissions
API: Allow permissions for status posts
This commit is contained in:
commit
d60c405390
1 changed files with 11 additions and 6 deletions
|
@ -49,6 +49,8 @@ class Update extends BaseApi
|
||||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
$uid = self::getCurrentUserID();
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
|
$owner = User::getOwnerDataById($uid);
|
||||||
|
|
||||||
$request = self::getRequest([
|
$request = self::getRequest([
|
||||||
'htmlstatus' => '',
|
'htmlstatus' => '',
|
||||||
'status' => '',
|
'status' => '',
|
||||||
|
@ -59,10 +61,12 @@ class Update extends BaseApi
|
||||||
'media_ids' => '',
|
'media_ids' => '',
|
||||||
'source' => '',
|
'source' => '',
|
||||||
'include_entities' => false,
|
'include_entities' => false,
|
||||||
|
'contact_allow' => $owner['allow_cid'],
|
||||||
|
'group_allow' => $owner['allow_gid'],
|
||||||
|
'contact_deny' => $owner['deny_cid'],
|
||||||
|
'group_deny' => $owner['deny_gid'],
|
||||||
], $request);
|
], $request);
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
|
||||||
|
|
||||||
if (!empty($request['htmlstatus'])) {
|
if (!empty($request['htmlstatus'])) {
|
||||||
$body = HTML::toBBCodeVideo($request['htmlstatus']);
|
$body = HTML::toBBCodeVideo($request['htmlstatus']);
|
||||||
|
|
||||||
|
@ -96,10 +100,11 @@ class Update extends BaseApi
|
||||||
$item['coord'] = sprintf("%s %s", $request['lat'], $request['long']);
|
$item['coord'] = sprintf("%s %s", $request['lat'], $request['long']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['allow_cid'] = $owner['allow_cid'] ?? '';
|
$aclFormatter = DI::aclFormatter();
|
||||||
$item['allow_gid'] = $owner['allow_gid'] ?? '';
|
$item['allow_cid'] = $aclFormatter->toString($request['contact_allow']);
|
||||||
$item['deny_cid'] = $owner['deny_cid'] ?? '';
|
$item['allow_gid'] = $aclFormatter->toString($request['group_allow']);
|
||||||
$item['deny_gid'] = $owner['deny_gid'] ?? '';
|
$item['deny_cid'] = $aclFormatter->toString($request['contact_deny']);
|
||||||
|
$item['deny_gid'] = $aclFormatter->toString($request['group_deny']);
|
||||||
|
|
||||||
if (!empty($item['allow_cid'] . $item['allow_gid'] . $item['deny_cid'] . $item['deny_gid'])) {
|
if (!empty($item['allow_cid'] . $item['allow_gid'] . $item['deny_cid'] . $item['deny_gid'])) {
|
||||||
$item['private'] = Item::PRIVATE;
|
$item['private'] = Item::PRIVATE;
|
||||||
|
|
Loading…
Reference in a new issue