-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
57 changed files
with
887 additions
and
1,314 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
component/api/src/main/java/io/meeds/social/space/administration/model/SpacePermissions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* This file is part of the Meeds project (https://meeds.io/). | ||
* | ||
* Copyright (C) 2020 - 2024 Meeds Association [email protected] | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
package io.meeds.social.space.administration.model; | ||
|
||
import java.util.List; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SpacePermissions { | ||
|
||
private List<String> layoutPermissions; | ||
|
||
private List<String> publicSitePermissions; | ||
|
||
private List<String> deletePermissions; | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...rc/main/java/io/meeds/social/space/administration/service/SpaceAdministrationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.meeds.social.space.administration.service; | ||
|
||
import org.exoplatform.commons.exception.ObjectNotFoundException; | ||
import org.exoplatform.social.core.space.model.Space; | ||
|
||
import io.meeds.social.space.administration.model.SpacePermissions; | ||
|
||
public interface SpaceAdministrationService { | ||
|
||
/** | ||
* @param spaceId {@link Space} technical id | ||
* @return Space permissions with layoutPermissions, deletePermissions and | ||
* publicSitePermissions | ||
* @throws ObjectNotFoundException when the space doesn't exist | ||
*/ | ||
SpacePermissions getSpacePermissions(long spaceId) throws ObjectNotFoundException; | ||
|
||
/** | ||
* @param spaceId {@link Space} technical id | ||
* @param permissions Space permissions with layoutPermissions, | ||
* deletePermissions and publicSitePermissions | ||
* @throws ObjectNotFoundException when the space doesn't exist | ||
*/ | ||
void updateSpacePermissions(long spaceId, SpacePermissions permissions) throws ObjectNotFoundException; | ||
|
||
} |
36 changes: 0 additions & 36 deletions
36
...nent/api/src/main/java/org/exoplatform/social/core/space/SpacesAdministrationService.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ain/java/io/meeds/social/space/administration/service/SpaceAdministrationServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.meeds.social.space.administration.service; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import org.exoplatform.commons.exception.ObjectNotFoundException; | ||
import org.exoplatform.social.core.space.model.Space; | ||
import org.exoplatform.social.core.space.spi.SpaceService; | ||
|
||
import io.meeds.social.space.administration.model.SpacePermissions; | ||
|
||
import lombok.Setter; | ||
|
||
@Service | ||
public class SpaceAdministrationServiceImpl implements SpaceAdministrationService { | ||
|
||
private static final String SPACE_NOT_FOUN_MESSAGE = "Space with id %s doesn't exist"; | ||
|
||
@Setter | ||
@Autowired | ||
private SpaceService spaceService; | ||
|
||
@Override | ||
public SpacePermissions getSpacePermissions(long spaceId) throws ObjectNotFoundException { | ||
Space space = spaceService.getSpaceById(spaceId); | ||
if (space == null) { | ||
throw new ObjectNotFoundException(String.format(SPACE_NOT_FOUN_MESSAGE, spaceId)); | ||
} | ||
return new SpacePermissions(space.getLayoutPermissions(), | ||
space.getPublicSitePermissions(), | ||
space.getDeletePermissions()); | ||
} | ||
|
||
@Override | ||
public void updateSpacePermissions(long spaceId, SpacePermissions permissions) throws ObjectNotFoundException { | ||
Space space = spaceService.getSpaceById(spaceId); | ||
if (space == null) { | ||
throw new ObjectNotFoundException(String.format(SPACE_NOT_FOUN_MESSAGE, spaceId)); | ||
} | ||
space.setLayoutPermissions(permissions.getLayoutPermissions()); | ||
space.setPublicSitePermissions(permissions.getPublicSitePermissions()); | ||
space.setDeletePermissions(permissions.getDeletePermissions()); | ||
spaceService.updateSpace(space); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.