Skip to content

Commit

Permalink
[1643] Remove the dependency from Sirius Web to Spring security
Browse files Browse the repository at this point in the history
Bug: #1643
Signed-off-by: Michaël Charfadi michael.charfadi@obeosoft.com
  • Loading branch information
mcharfadi authored and sbegaudeau committed Feb 24, 2023
1 parent 02810fc commit ca1c5d1
Show file tree
Hide file tree
Showing 50 changed files with 57 additions and 1,165 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

=== Breaking changes

- https://github.com/eclipse-sirius/sirius-components/issues/1643[1643] [core] Removed our dependencies to Spring Security

=== Dependency update

=== Bug fixes
Expand Down
1 change: 0 additions & 1 deletion integration-tests/cypress/support/serverCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ Cypress.Commands.add('createProject', (name) => {
input: {
id: uuid(),
name,
visibility: 'PUBLIC',
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Obeo.
* Copyright (c) 2019, 2023 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -22,8 +22,6 @@
* type Project {
* id: ID!
* name: String!
* owner: Account!
* visibility: Visibility!
* currentEditingContext: EditingContext!
* }
* </pre>
Expand All @@ -35,9 +33,5 @@ public class ProjectTypeProvider {

public static final String NAME_FIELD = "name";

public static final String OWNER_FIELD = "owner";

public static final String VISIBILITY_FIELD = "visibility";

public static final String CURRENT_EDITING_CONTEXT_FIELD = "currentEditingContext";
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ type Project {
id: ID!
name: String!
currentEditingContext: EditingContext!
owner: Profile!
visibility: Visibility!
customImages: [CustomImage!]!
}

Expand All @@ -27,16 +25,6 @@ type CustomImage {
url: String!
}

type Profile {
id: ID!
username: String!
}

enum Visibility {
PRIVATE
PUBLIC
}

type ProjectTemplate {
id: ID!
label: String!
Expand Down Expand Up @@ -83,7 +71,6 @@ extend type Mutation {
input CreateProjectInput {
id: ID!
name: String!
visibility: Visibility!
}

union CreateProjectPayload = ErrorPayload | CreateProjectSuccessPayload
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Obeo.
* Copyright (c) 2019, 2023 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -16,17 +16,11 @@
import java.util.UUID;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

/**
* Project entity used by the persistence layer.
*
Expand All @@ -42,14 +36,6 @@ public class ProjectEntity {

private String name;

@ManyToOne
@JoinColumn(name = "owner_id")
private AccountEntity owner;

@Enumerated(EnumType.STRING)
@Type(type = "org.eclipse.sirius.web.persistence.util.VisibilityEnumType")
private VisibilityEntity visibility = VisibilityEntity.PUBLIC;

public UUID getId() {
return this.id;
}
Expand All @@ -66,25 +52,9 @@ public void setName(String name) {
this.name = name;
}

public AccountEntity getOwner() {
return this.owner;
}

public void setOwner(AccountEntity owner) {
this.owner = owner;
}

public VisibilityEntity getVisibility() {
return this.visibility;
}

public void setVisibility(VisibilityEntity visibility) {
this.visibility = visibility;
}

@Override
public String toString() {
String pattern = "{0} '{'id: {1}, name: {2}, owner: {3}, visibility: {4}'}'";
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.name, this.owner, this.visibility);
String pattern = "{0} '{'id: {1}, name: {2}'}'";
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.name);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
*******************************************************************************/
package org.eclipse.sirius.web.persistence.repositories;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

import org.eclipse.sirius.components.annotations.Audited;
import org.eclipse.sirius.web.persistence.entities.AccessLevelEntity;
import org.eclipse.sirius.web.persistence.entities.ProjectEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

Expand All @@ -34,31 +31,10 @@
*/
@Repository
public interface IProjectRepository extends PagingAndSortingRepository<ProjectEntity, UUID> {

@Audited
@Query(name = "Project.getUserAccessLevel", nativeQuery = true)
AccessLevelEntity getUserAccessLevel(UUID projectId, String userName);

@Audited
@Query(name = "Project.existsByIdAndIsVisibleBy", nativeQuery = true)
boolean existsByIdAndIsVisibleBy(UUID id, String username);

@Audited
@Query(name = "Project.findAllVisibleBy", nativeQuery = true)
List<ProjectEntity> findAllVisibleBy(String username);

@Audited
@Query(name = "Project.findByIdIfVisibleBy", nativeQuery = true)
Optional<ProjectEntity> findByIdIfVisibleBy(UUID projectId, String currentUsername);

@Audited
@Override
Optional<ProjectEntity> findById(UUID id);

@Audited
@Query(name = "Project.isOwner")
boolean isOwner(String username, UUID projectId);

@Audited
@Override
<S extends ProjectEntity> S save(S projectEntity);
Expand Down

0 comments on commit ca1c5d1

Please sign in to comment.