Skip to content

Commit

Permalink
feat: Adjust publish article from existing note permissions - EXO-755…
Browse files Browse the repository at this point in the history
…20 - Meeds-io/MIPs#161 (#323)

Adjust publish article from existing note permissions
  • Loading branch information
hakermi committed Nov 27, 2024
1 parent 86dfb69 commit 8375449
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,8 @@ public List<NewsESSearchResult> search(org.exoplatform.social.core.identity.mode
@Override
public boolean canScheduleNews(Space space, Identity currentIdentity, News article) {
boolean isArticleAuthor = article.getAuthor() != null && article.getAuthor().equals(currentIdentity.getUserId());
boolean spaceMemberCanSchedule = isArticleAuthor && spaceService.isMember(space, currentIdentity.getUserId());
boolean spaceMemberCanSchedule = (article.isFromExternalPage() || isArticleAuthor)
&& spaceService.isMember(space, currentIdentity.getUserId());
return spaceMemberCanSchedule || spaceService.isManager(space, currentIdentity.getUserId())
|| spaceService.isRedactor(space, currentIdentity.getUserId())
|| NewsUtils.canPublishNews(space.getId(), currentIdentity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function initPublishExtension(params) {
sortable: true,
cssClass: 'ps-2 pe-4 action-menu-item',
rank: 30,
enabled: (note) => eXo?.env?.portal?.notePublicationEnabled && !note.draftPage,
enabled: (note) => eXo?.env?.portal?.notePublicationEnabled && !note.draftPage && note.canManage,
action: (vm) => {
vm.$root.$emit('open-publish-drawer', {
savedSettings: params.savedSettings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,14 @@ export function canScheduleNews(spaceId, articleId) {
'Content-Type': 'application/json'
},
method: 'GET'
}).then((resp) => resp && resp.ok && resp.json());
}).then((response) => {
if (!response?.ok) {
throw response;
}
return response.json();
}).catch(err => {
throw err;
});
}

export function deleteNews(newsId, newsObjectType, delay) {
Expand Down

0 comments on commit 8375449

Please sign in to comment.