Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing feature #566

Merged
merged 41 commits into from
Nov 26, 2020
Merged

Sharing feature #566

merged 41 commits into from
Nov 26, 2020

Conversation

franklma
Copy link
Contributor

  1. Sharing window in the portal
  2. Dashboard list window
  3. Filter list window
  4. Migration solution for usermetadata table

Copy link
Contributor

@raboczi raboczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we arrange to meet and have you walk Nolan and me through this? There's nothing obviously out of place, but since it deal with the common code in the Manager I'd like to understand it a little better first.

private String createdBy;
private String updatedTime;
private String accessType;
private boolean canShare;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider renaming to shareable, editable, viewable. Makes the getter/setter readable


@Inject
public AuthorizationServiceImpl(final WorkspaceService workspaceService) {
public AuthorizationServiceImpl(final WorkspaceService workspaceService, UserMetadataService userMetadataService) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make UserMetadataService final as well.

@@ -98,6 +101,14 @@ public SecurityService getSecurityService() {
return securityService;
}

public AuthorizationService getAuthorizationService() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isnt the authorizationService injected?

Group userAsGroup = getSecurityService().getGroupByName(userName);
Map<Group, AccessType> groupAccessMap;
Integer selectedItemId = summaryType.getId();
if (summaryType instanceof ProcessSummaryType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karthik-balasubramanian I think in this context, instanceof is simply used for type checking to verify allowable actions for the object of interest. Could you suggest an alternative to do that? We can introduce some kind of enum-based typing but instanceof seems to be the most efficient (https://stackoverflow.com/revisions/26514984/10).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using instanceOf operator is not object oriented programming. We should create an interface that has an abstract method, say getAllowableAction that returns the groupAccessMap. The summary type can implement that interface and each summary type will provide the appropriate access type.

Also we dont need to do premature optimization. One level of indirection is not going to add a lot of performance impact here.

Usermetadata findById(Integer id);
//
// @Query("SELECT um FROM Usermetadata WHERE um.id = ?1 FOR UPDATE")
// @org.springframework.data.jpa.repository.QueryHints(value = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this commented out query

@karthik-balasubramanian
Copy link
Contributor

Please add unit tests for the Controller, Service classes etc.

}

@Override
public void saveLogAccessType(Integer logId, String groupRowGuid, AccessType accessType, boolean shareUserMetadata) {

if (!accessType.equals(AccessType.NONE)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to if(!AccessType.NONE.equals(accessType)) to avoid NPE

@Override
public void saveUserMetadtarAccessType(Integer userMetadataId, String groupRowGuid, AccessType accessType) {

if (!accessType.equals(AccessType.NONE)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

createGroupLog(group, log, hasRead, hasWrite, hasOwnership);

Folder parentFolder = log.getFolder();
while (parentFolder != null && parentFolder.getId() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change this to a recursive call instead of using a while loop

Copy link
Contributor

@raboczi raboczi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm satisfied that this is good enough to merge.

The need to create new classes like Artifact and AccessRights isn't so much a problem of code duplication as indicative that our existing business object model is inadequate and forcing people to work around it. Until we can find the time to fix the foundations, this sort of workaround is as clean a way as we can manage.

Minor quibble: it'd be nice to standardize on either Usermetadata or UserMetadata.

@raboczi raboczi merged commit f79ecd6 into development Nov 26, 2020
@raboczi raboczi deleted the AP-2448 branch November 26, 2020 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants