Skip to content

Commit

Permalink
Merge pull request #515 from COS301-SE-2023/dev
Browse files Browse the repository at this point in the history
Update main
  • Loading branch information
P3TROOS authored Oct 25, 2023
2 parents d0a6261 + 38891a9 commit 5d152f6
Show file tree
Hide file tree
Showing 56 changed files with 834 additions and 716 deletions.
94 changes: 47 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
[![codecov](https://codecov.io/gh/COS301-SE-2023/InfoSafe/branch/dev/graph/badge.svg?token=7T6WCYXEIO)](https://codecov.io/gh/COS301-SE-2023/infosafe)
[![Languages](https://img.shields.io/github/languages/count/COS301-SE-2023/InfoSafe.svg)](https://github.com/COS301-SE-2023/InfoSafe)

[![Javascript](https://img.shields.io/badge/-Javascript-yellow?logo=javascript&logoColor=white&style=flat&label=%2050.5%25)](https://www.javascript.com)
[![Javascript](https://img.shields.io/badge/-Javascript-yellow?logo=javascript&logoColor=white&style=flat&label=%2050.0%25)](https://www.javascript.com)
[![CSS](https://img.shields.io/badge/-css-lightblue?logo=css3&logoColor=white&style=flat&label=%2025.1%25)](https://www.css3.com)
[![Java](https://img.shields.io/badge/-Java-blue?logo=java&logoColor=white&style=flat&label=%2024.2%25)](https://www.java.com)
[![Java](https://img.shields.io/badge/-Java-blue?logo=java&logoColor=white&style=flat&label=%2024.7%25)](https://www.java.com)
[![HTML](https://img.shields.io/badge/-html-orange?logo=html5&logoColor=white&style=flat&label=%200.2%25)](https://www.html5.org)

<hr>
Expand All @@ -26,7 +26,11 @@

# Project Name

![InfoSafe](documentation/images/Infosafe.png)
[![InfoSafe](documentation/images/Infosafe_light.png)](https://www.infosafe.live)


https://github.com/COS301-SE-2023/InfoSafe/assets/64251227/d70e8edb-b2cd-4245-af20-d39d70030de9


<hr>

Expand All @@ -43,40 +47,31 @@ Users will be assigned certain roles when their profile has been created on the
## Resources

### Website Link:
- http://www.infosafe.live
- :globe_with_meridians: <a href="https://www.infosafe.live" target="_blank">infosafe.live</a>

### Demo Videos:
- :vhs: [Demo 1](https://drive.google.com/file/d/1ITE_PmSBuUV0yr15rl-cxy_T7-QDalcL/view?usp=drive_link)
- :vhs: [Demo 2](https://drive.google.com/file/d/1ZGrzbsJevsbJFgryFvfZMmA00x-Y2ty9/view?usp=drive_link)
- :vhs: [Demo 3](https://drive.google.com/file/d/1Byp2w_3blPnhIuS8_RPcRq3NpRkeo-R9/view?usp=drive_link)
- :video_camera: All our demo videos and system advert can be found [here](https://github.com/COS301-SE-2023/InfoSafe/wiki/Demo-Videos).

### Systems Requirements and Specifications Documentation:
- :blue_book: [version 1](https://drive.google.com/file/d/12gjxXfBSKLG_F2ungz51kjOnD9s0LEy1/view?usp=drive_link)
- :green_book: [Version 2](https://drive.google.com/file/d/1Oa8bjlcI5w0uFtQGIbiPc1iHjV5Xj-s7/view?usp=drive_link)
- :orange_book: [Version 3](https://drive.google.com/file/d/1gsfEIISYS6TjLWlR5U_ChzInj6DKuebH/view?usp=drive_link)
- :closed_book: [Version 4](https://drive.google.com/file/d/1PH0oyDoa9nUwE1L9Cu7blbRQAmjbsBtP/view?usp=drive_link)
- :closed_book: [Version 5](https://drive.google.com/file/d/1vMEvUsn78RC-QkEYLcwxt0_vo5DOeDeJ/view?usp=share_link) is the latest version. The older versions can be found [here](https://github.com/COS301-SE-2023/InfoSafe/wiki/Systems-Requirements-and-Specifications-Documentations).

### Supporting Documentation:
- :cd: [Installation Guide](https://drive.google.com/file/d/125hVZvrzfT5g-fSAJtC2lvuoXEt2QXdl/view?usp=drive_link)
- :scroll: [User Manual](documentation/document_files/Infosafe_User_Manual_V4.pdf)
- :triangular_ruler: [System Architecture](https://drive.google.com/file/d/1imZXfUnqDkVMFoVG3KLTdezh4MdND6yX/view?usp=drive_link)
- :test_tube: [Testing Policy](https://drive.google.com/file/d/1OaNACeGeoWsiuj7rx3519Z2q8MjpRZz5/view?usp=drive_link)
- :floppy_disk: [Database Design](https://drive.google.com/file/d/1l1JDXrADDrWAG31QOSZ7N1B5cr5oR-vK/view?usp=drive_link)
- :chart_with_upwards_trend: [Coding Standards](https://drive.google.com/file/d/1_sKT6zhU0sPqjddguFlqAj6KHSsFdvM5/view?usp=drive_link)
- :memo: [Team Contributions](https://drive.google.com/file/d/1b7-6Zc-ByUvRKBeV02A9hv8H-e-NqnMR/view?usp=drive_link)
- :bookmark_tabs: All our supporting documentation can be found [here](https://github.com/COS301-SE-2023/InfoSafe/wiki/Supporting-Documentation).

### GitHub Links:
- :bar_chart: [Organization](https://github.com/COS301-SE-2023/InfoSafe/wiki/GitHub-Structure,-Organization-and-Management)
- :dart: [Project Board](https://github.com/orgs/COS301-SE-2023/projects/17/views/1)
- :computer: [Wiki](https://github.com/COS301-SE-2023/InfoSafe/wiki)
- :dart: [Project Board](https://github.com/orgs/COS301-SE-2023/projects/17/views/1)

<hr>

## Meet the Team

- ### Christof Steyn
<details>
<summary><b>:microscope: Christof Steyn</b></summary>
- Team Lead, Backend, Database and Hosting, Integration, Dev-ops, Testing
<br>
<img src="documentation/images/cs.png" alt="Christof Steyn Profile Image" width="250" height="250">

<br>
I am a third year BSc Information and Knowledge Systems (Software Development) student. I have a huge passion for technology and the influence it has on the evolving world around us. I have experience in both software development and informatics (system design and analysis). I am familiar with most front-end technologies but, I have a great interest and understanding in back-end/server-side technologies. As our team leader I value efficient team organisation and strong communication as well as effective time management and leadership.

I am proficient in:
Expand All @@ -89,14 +84,15 @@ I am proficient in:


#### Profiles:
<a href="https://github.com/P3TROOS"><img src="documentation/images/GitHub.jpeg" alt="christof github" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.Linkedin.com/in/christof-steyn-631420218/"><img src="documentation/images/Linkedin.png" alt="christof linkedin" width="30" height="30"></a>
<a href="https://github.com/P3TROOS"><img src="documentation/images/GitHub.jpeg" alt="christof github" target="_blank" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/christof-steyn-631420218/"><img src="documentation/images/Linkedin.png" alt="christof linkedin" target="_blank" width="30" height="30"></a>
</details>


<hr>

- ### Chris Mittendorf
<details>
<summary><b>:floppy_disk: Chris Mittendorf</b></summary>
- Backend, Dev-ops, Integration, Database and Hosting, Documentation, Testing
<br>
<img src="documentation/images/cm.png" alt="Chris Mittendorf Profile Image" width="250" height="250">

<br>
I am a third year BSc Computer Science student. I found my passion for technology and programming completing my first degree in BSc Geography. I enjoy creating programmes to work in real world applications and have an interest in organisation and database management. I have experience in the MVC framework development which will benefit this project. I consider myself to be quite creative and want to explore more work in frontend development but currently do more work on the backend side of projects. I work very well in teams and believe in efficient communication throughout a team in order to maximise its potential.

I am proficient in:
Expand All @@ -108,14 +104,15 @@ I am proficient in:
- [![ASP.Net (MVC)](https://img.shields.io/badge/ASP.Net-lightblue.svg)](https://en.wikipedia.org/wiki/ASP.NET)

#### Profiles:
<a href="https://github.com/ChrisMitt"><img src="documentation/images/GitHub.jpeg" alt="chris github" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/chris-mittendorf-078542275/"><img src="documentation/images/Linkedin.png" alt="chris linkedin" width="30" height="30"></a>

<a href="https://github.com/ChrisMitt"><img src="documentation/images/GitHub.jpeg" alt="chris github" target="_blank" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/chris-mittendorf-078542275/"><img src="documentation/images/Linkedin.png" alt="chris linkedin" target="_blank" width="30" height="30"></a>
</details>

<hr>

- ### Yané van der Westhuizen
<details>
<summary><b>:art: Yané van der Westhuizen</b></summary>
- Frontend, UI Designer, UI Engineer
<br>
<img src="documentation/images/yvdw.png" alt="Yané van der Westhuizen Profile Image" width="250" height="250">

<br>
I am a third year BSc Computer Science student. I have always been very fascinated by technology and how it is ever-evolving. I have experience in full-stack development, with a particular interest in front-end development and web development. I am also well-versed in databases, including SQL and NoSQL databases and various different database management systems. I pride myself in being very organised and diligent.

I am proficient in:
Expand All @@ -129,13 +126,15 @@ I am proficient in:
- [![NoSQL](https://img.shields.io/badge/NoSQL-8f2c3e.svg)](https://en.wikipedia.org/wiki/NoSQL)

#### Profiles:
<a href="https://github.com/yanevdw19021209"><img src="documentation/images/GitHub.jpeg" alt="yane github" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/yan%C3%A9-van-der-westhuizen-232359226/"><img src="documentation/images/Linkedin.png" alt="yane linkedin" width="30" height="30"></a>
<a href="https://github.com/yanevdw19021209"><img src="documentation/images/GitHub.jpeg" alt="yane github" target="_blank" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/yan%C3%A9-van-der-westhuizen-232359226/"><img src="documentation/images/Linkedin.png" alt="yane linkedin" target="_blank" width="30" height="30"></a>
</details>

<hr>

- ### Karel Smit
<details>
<summary><b>:pencil2: Karel Smit</b></summary>
- Frontend, UI Designer, UI Engineer
<br>
<img src="documentation/images/ks.png" alt="Karel Smit Profile Image" width="250" height="250">

<br>
Karel Smit is an aspiring Software Engineer, who has a keen interest in problem-solving and a third year BSc Computer Science student. He is proficient in front-end and back-end development, with a focus on web-based development. He is proficient in various programming languages, and able to use many popular, industry standard development tools. He is adaptable, good at communicating and is a quick learner, which along with his strong work ethic makes him a reliable member of any team.

- [![Java](https://img.shields.io/badge/Java-blue.svg)](https://en.wikipedia.org/wiki/Java_(programming_language))
Expand All @@ -147,14 +146,15 @@ Karel Smit is an aspiring Software Engineer, who has a keen interest in problem-
- [![PHP](https://img.shields.io/badge/PHP-purple.svg)](https://en.wikipedia.org/wiki/PHP)

#### Profiles:
<a href="https://github.com/KarelSmit"><img src="documentation/images/GitHub.jpeg" alt="karel github" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/karel-smit-9a7929275/"><img src="documentation/images/Linkedin.png" alt="karel linkedin" width="30" height="30"></a>
<a href="https://github.com/KarelSmit"><img src="documentation/images/GitHub.jpeg" alt="karel github" target="_blank" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/karel-smit-9a7929275/"><img src="documentation/images/Linkedin.png" alt="karel linkedin" target="_blank" width="30" height="30"></a>
</details>


<hr>

- ### Alistair Ross
<details>
<summary><b>:wrench: Alistair Ross</b></summary>
- Backend, Database and Hosting, Security, Dev-ops, Integration, Testing
<br>
<img src="documentation/images/ar.png" alt="Alistair Ross Profile Image" width="250" height="250">

<br>
I am a third year Computer Science student. I am particularly interested in software development with a focus on problem-solving algorithms and data structures. I value organisation and thus have a great appreciation for the use of git as well as its correct set up. I work hard and put in the effort until the end to get the job done.

I am proficient in:
Expand All @@ -165,5 +165,5 @@ I am proficient in:
- [![SQL](https://img.shields.io/badge/SQL-a7f77e.svg)](https://en.wikipedia.org/wiki/SQL)

#### Profiles:
<a href="https://github.com/AlistairMRoss"><img src="documentation/images/GitHub.jpeg" alt="alistair github" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/alistair-ross-1b647a204/"><img src="documentation/images/Linkedin.png" alt="alistair linkedin" width="30" height="30"></a>

<a href="https://github.com/AlistairMRoss"><img src="documentation/images/GitHub.jpeg" alt="alistair github" target="_blank" width="30" height="30"></a> &#8203; &#8203; <a href="https://www.linkedin.com/in/alistair-ross-1b647a204/"><img src="documentation/images/Linkedin.png" alt="alistair linkedin" target="_blank" width="30" height="30"></a>
</details>
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.fragile.infosafe.delete.deletemodel;

import com.fragile.infosafe.primary.model.User;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

@Data
@Builder
Expand All @@ -24,4 +27,9 @@ public class DeletedTask {
private String date_created;
private String completionStatus;

@ElementCollection
@CollectionTable(name = "delete_task_users", joinColumns = @JoinColumn(name = "task_id"))
@Column(name = "user_id")
private Set<Integer> userIds = new HashSet<>();

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import com.fragile.infosafe.delete.deletemodel.DeletedTask;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface DeletedTaskRepository extends JpaRepository<DeletedTask, Integer> {

@Query("SELECT COUNT(dt) FROM DeletedTask dt JOIN dt.userIds u WHERE u = :userId")
long countByUserId(int userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(Arrays.asList("http://localhost:8080", "http://localhost:3000", "https://infosafe.live")); //""
configuration.setAllowedOrigins(Arrays.asList("https://infosafe.live", "http://localhost:3000", "https://infosafe.live")); //""
configuration.setAllowedMethods(Arrays.asList("*"));
configuration.setAllowedHeaders(Arrays.asList("*"));
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import lombok.extern.slf4j.Slf4j;
import org.hibernate.sql.Delete;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;

import java.util.List;
Expand Down Expand Up @@ -50,4 +52,16 @@ public ResponseEntity<String> setCompletedTasks(@RequestBody TaskCompleteRequest
public ResponseEntity<List<String>> getUsersOfTask(@PathVariable("id") int task_id){
return ResponseEntity.ok(service.findUsersOfTask(task_id));
}

@GetMapping("/getCompleted")
public ResponseEntity<Long> getCompletedTasks(){
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null && authentication.getPrincipal() instanceof User authenticatedUser) {
long count = service.getCompletedTasks(authenticatedUser.getUser_id());
return ResponseEntity.ok(count);
}else {
return ResponseEntity.notFound().build();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class Task {
inverseJoinColumns = @JoinColumn(name = "user_id")
)
private Set<User> users = new HashSet<>();

@Column(nullable = true)
private int daysUntilDue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ public class User implements UserDetails {
@OneToMany(mappedBy = "user_id", fetch = FetchType.LAZY)
private List<AccessRequest> accessRequests;

@JsonIgnore
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
private List<Notifications> notifications;

@JsonIgnore
@ManyToMany(mappedBy = "users", fetch = FetchType.LAZY)
private List<Task> tasks;

@JsonIgnore
@ManyToMany(mappedBy = "users", fetch = FetchType.LAZY)
private List<DataScope> dataScopes;

@Override
public String toString() {
return "User{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ public ResponseEntity<String> makeAR(AccessRequestRequest request, User authenti
public List<AccessRequest> getAllAccessRequests() {
List<AccessRequest> ar = accessRequestRepository.findAll();
for(AccessRequest accessRequest : ar){
accessRequest.getUser_id().setFirst_name(encryptionService.decryptString(accessRequest.getUser_id().getFirst_name()));
accessRequest.getUser_id().setLast_name(encryptionService.decryptString(accessRequest.getUser_id().getLast_name()));
User currentAssignee = accessRequest.getUser_id();
User decryptedCurrentAssignee = new User();
decryptedCurrentAssignee.setUser_id(currentAssignee.getUser_id());
decryptedCurrentAssignee.setFirst_name(encryptionService.decryptString(currentAssignee.getFirst_name()));
decryptedCurrentAssignee.setLast_name(encryptionService.decryptString(currentAssignee.getLast_name()));
decryptedCurrentAssignee.setEmail(currentAssignee.getEmail());
decryptedCurrentAssignee.setRole(currentAssignee.getRole());
accessRequest.setUser_id(decryptedCurrentAssignee);
}
return ar;
}
Expand Down Expand Up @@ -82,7 +88,7 @@ public ResponseEntity<String> reviewAccessRequest(ReviewRequest reviewRequest) {
}
} else {
deleteService.deleteAccessRequestAndSaveToSecondary(reviewRequest.getRequest_id());
emailUser(reviewRequest.getUser_email(), "", "Denied");
emailUser(encryptionService.decryptString(reviewRequest.getUser_email()), "", "Denied");
String message = "rejected access";
return ResponseEntity.ok(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ public ResponseEntity<String> makeAR(AssetRequestRequest request, User authentic
public List<AssetRequests> getAllAssetRequests() {
List<AssetRequests> ar = assetRequestRepository.findAll();
for (AssetRequests assetRequests : ar) {
assetRequests.getUser().setFirst_name(encryptionService.decryptString(assetRequests.getUser().getFirst_name()));
assetRequests.getUser().setLast_name(encryptionService.decryptString(assetRequests.getUser().getLast_name()));
User currentAssignee = assetRequests.getUser();
User decryptedCurrentAssignee = new User();
decryptedCurrentAssignee.setUser_id(currentAssignee.getUser_id());
decryptedCurrentAssignee.setFirst_name(encryptionService.decryptString(currentAssignee.getFirst_name()));
decryptedCurrentAssignee.setLast_name(encryptionService.decryptString(currentAssignee.getLast_name()));
decryptedCurrentAssignee.setEmail(currentAssignee.getEmail());
decryptedCurrentAssignee.setRole(currentAssignee.getRole());
assetRequests.setUser(decryptedCurrentAssignee);
}
return ar;
}
Expand Down Expand Up @@ -90,7 +96,7 @@ public ResponseEntity<String> reviewAssetRequest(ReviewRequest reviewRequest) {
}
} else {
deleteService.deleteAssetRequestAndSaveToSecondary(reviewRequest.getRequest_id());
emailUser(reviewRequest.getUser_email(), "", "Denied");
emailUser(encryptionService.decryptString(reviewRequest.getUser_email()), "", "Denied");
notificationsService.makeNotification("Asset Request Denied", userRepository.findByEmail(reviewRequest.getUser_email()).get());
return ResponseEntity.ok("rejected access");
}
Expand Down
Loading

0 comments on commit 5d152f6

Please sign in to comment.