Compare commits

...

5 commits

Author SHA1 Message Date
4f6b5bab31 Adding primevue to project
Some checks failed
ci/woodpecker/pr/check_fmt Pipeline failed
2025-04-04 11:48:14 +02:00
c6211418a6 Adding PrimeVue dependencies 2025-04-04 11:48:14 +02:00
jopejoe1
3139bab32f run treefmt 2025-04-04 11:32:19 +02:00
jopejoe1
00148b02eb make ci run on prs 2025-04-04 11:31:16 +02:00
ef002bf406 revert 54ca7f90b1
Some checks failed
ci/woodpecker/push/check_fmt Pipeline failed
revert commit fmt
2025-04-04 11:26:14 +02:00
18 changed files with 126 additions and 44 deletions

View file

@ -1,4 +1,4 @@
{
"rust-analyzer.check.features": "all",
"rust-analyzer.cargo.features": "all"
}
"rust-analyzer.check.features": "all",
"rust-analyzer.cargo.features": "all"
}

View file

@ -1,15 +1,8 @@
when:
- event: push
branch: main
- event: pull_request
steps:
- name: "Run nix flake check"
image: docker.nix-community.org/nixpkgs/nix-flakes
commands:
- nix fmt
- name: push commit
image: appleboy/drone-git-push
settings:
remote_name: origin
branch: main
local_ref: main
- nix fmt -- --fail-on-change

View file

@ -1,2 +1,3 @@
# peer-group-grading
Wir sind cool
Wir sind cool

View file

@ -2,8 +2,5 @@
"version": "1",
"name": "pgg-bruno",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}
"ignore": ["node_modules", ".git"]
}

View file

@ -1,11 +1,12 @@
use actix_session::Session;
use actix_web::{
HttpResponse, Responder, post,
post,
web::{self, ServiceConfig},
HttpResponse, Responder,
};
use serde::Deserialize;
use crate::{Database, error::ApiError};
use crate::{error::ApiError, Database};
#[derive(Deserialize)]
struct LoginRequest {

View file

@ -1,4 +1,4 @@
use actix_web::{Responder, delete, get, post, put};
use actix_web::{delete, get, post, put, Responder};
pub fn setup(cfg: &mut actix_web::web::ServiceConfig) {
cfg.service(get_classes)

View file

@ -1,4 +1,4 @@
use actix_web::{Responder, delete, get, post, put};
use actix_web::{delete, get, post, put, Responder};
pub fn setup(cfg: &mut actix_web::web::ServiceConfig) {
cfg.service(get_groups)

View file

@ -1,9 +1,9 @@
use actix_web::{Result, delete, get, post, put, web};
use actix_web::{delete, get, post, put, web, Result};
use uuid::Uuid;
use validator::Validate;
use crate::db::Database;
use crate::db::project::CreateProject;
use crate::db::Database;
use crate::entity;
use crate::error::ApiError;

View file

@ -1,4 +1,4 @@
use actix_web::{Responder, delete, get, post, put};
use actix_web::{delete, get, post, put, Responder};
pub fn setup(cfg: &mut actix_web::web::ServiceConfig) {
cfg.service(get_templates)

View file

@ -1,5 +1,5 @@
use crate::{Database, entity, error::ApiError};
use actix_web::{Responder, delete, get, post, put, web};
use crate::{entity, error::ApiError, Database};
use actix_web::{delete, get, post, put, web, Responder};
use serde::Deserialize;
use validator::Validate;

View file

@ -1,7 +1,7 @@
use crate::error::ApiError;
use argon2::{
password_hash::{rand_core::OsRng, PasswordHasher, SaltString},
Argon2, PasswordHash, PasswordVerifier,
password_hash::{PasswordHasher, SaltString, rand_core::OsRng},
};
use sea_orm::{
ActiveModelTrait,
@ -10,7 +10,7 @@ use sea_orm::{
};
use uuid::Uuid;
use crate::{Database, entity};
use crate::{entity, Database};
impl Database {
pub async fn create_user(

View file

@ -1,4 +1,4 @@
use actix_web::{HttpResponse, ResponseError, cookie::time::error, http::StatusCode};
use actix_web::{cookie::time::error, http::StatusCode, HttpResponse, ResponseError};
use sea_orm::TransactionError;
use thiserror::Error;

View file

@ -1,14 +1,14 @@
use actix_files::NamedFile;
use actix_session::{SessionMiddleware, storage::RedisSessionStore};
use actix_web::{App, HttpResponse, HttpServer, cookie::Key, middleware::Logger, web};
use actix_session::{storage::RedisSessionStore, SessionMiddleware};
use actix_web::{cookie::Key, middleware::Logger, web, App, HttpResponse, HttpServer};
use log::debug;
mod controller;
mod db;
mod error;
pub use db::Database;
pub use db::entity;
pub use db::Database;
#[derive(Clone)]
struct AppConfig {

View file

@ -30,17 +30,19 @@ fn authenticate_user(username: &str, password: &str) -> Result<bool, Box<dyn std
let ldap = LdapConn::new(&ldap_server)?;
// Search for the user in the LDAP directory
let (rs, _res) = ldap.search(
&format!("ou=users,{}", base_dn), // Search under "ou=users"
Scope::Subtree, // Search all levels
&format!("(uid={})", username), // Filter by username
vec!["dn"], // Retrieve the distinguished name (DN)
)?.success()?;
let (rs, _res) = ldap
.search(
&format!("ou=users,{}", base_dn), // Search under "ou=users"
Scope::Subtree, // Search all levels
&format!("(uid={})", username), // Filter by username
vec!["dn"], // Retrieve the distinguished name (DN)
)?
.success()?;
// If user is found, attempt to authenticate with their DN and password
if let Some(entry) = rs.into_iter().next() {
let user_dn = SearchEntry::construct(entry).dn; // Extract user DN
// Reconnect and bind with user credentials
let user_ldap = LdapConn::new(&ldap_server)?;
let auth_result = user_ldap.simple_bind(&user_dn, password)?.success();
@ -60,4 +62,4 @@ async fn main() -> std::io::Result<()> {
.bind(("127.0.0.1", 8080))?
.run()
.await
}
}

View file

@ -39,13 +39,21 @@ services:
- ./crates/ldap/src/users.ldif:/container/service/slapd/assets/config/bootstrap/ldif/custom/users.ldif
healthcheck:
test: ["CMD", "ldapsearch", "-x", "-H", "ldap://localhost", "-b", "dc=Schule,dc=intern"]
test:
[
"CMD",
"ldapsearch",
"-x",
"-H",
"ldap://localhost",
"-b",
"dc=Schule,dc=intern",
]
interval: 30s
retries: 3
volumes:
postgres_data:
redis:
openldap_data:
openldap_config:
openldap_config:

View file

@ -14,7 +14,9 @@
"format": "prettier --write src/"
},
"dependencies": {
"@primeuix/themes": "^1.0.1",
"pinia": "^3.0.1",
"primevue": "^4.3.3",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
},

View file

@ -2,12 +2,19 @@ import './assets/main.css'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import PrimeVue from 'primevue/config';
import Aura from '@primeuix/themes/aura';
import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(PrimeVue, {
theme: {
preset: Aura
}
})
app.use(createPinia())
app.use(router)

71
pnpm-lock.yaml generated
View file

@ -10,9 +10,15 @@ importers:
frontend:
dependencies:
'@primeuix/themes':
specifier: ^1.0.1
version: 1.0.1
pinia:
specifier: ^3.0.1
version: 3.0.1(typescript@5.8.2)(vue@3.5.13(typescript@5.8.2))
primevue:
specifier: ^4.3.3
version: 4.3.3(vue@3.5.13(typescript@5.8.2))
vue:
specifier: ^3.5.13
version: 3.5.13(typescript@5.8.2)
@ -516,6 +522,30 @@ packages:
'@polka/url@1.0.0-next.28':
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
'@primeuix/styled@0.5.1':
resolution: {integrity: sha512-5Ftw/KSauDPClQ8F2qCyCUF7cIUEY4yLNikf0rKV7Vsb8zGYNK0dahQe7CChaR6M2Kn+NA2DSBSk76ZXqj6Uog==}
engines: {node: '>=12.11.0'}
'@primeuix/styles@1.0.1':
resolution: {integrity: sha512-R7SX001ILHIJM9hh1opbsuOFFK8dOM8GY1y99jaCFnAc5gGy3mFPJMhoexRYV1a6UZ2YbfcsQVPbIhoONI1gfg==}
'@primeuix/themes@1.0.1':
resolution: {integrity: sha512-RllttI3oGTZa66UQDCIA2lPnJvO/xqtNpy+0eNql6fIxdS2AUg5n7L81jTZrHNZ+31T5OBzL/SGFCDycmHTz2g==}
'@primeuix/utils@0.5.3':
resolution: {integrity: sha512-7SGh7734wcF1/uK6RzO6Z6CBjGQ97GDHfpyl2F1G/c7R0z9hkT/V72ypDo82AWcCS7Ta07oIjDpOCTkSVZuEGQ==}
engines: {node: '>=12.11.0'}
'@primevue/core@4.3.3':
resolution: {integrity: sha512-kSkN5oourG7eueoFPIqiNX3oDT/f0I5IRK3uOY/ytz+VzTZp5yuaCN0Nt42ZQpVXjDxMxDvUhIdaXVrjr58NhQ==}
engines: {node: '>=12.11.0'}
peerDependencies:
vue: ^3.5.0
'@primevue/icons@4.3.3':
resolution: {integrity: sha512-ouQaxHyeFB6MSfEGGbjaK5Qv9efS1xZGetZoU5jcPm090MSYLFtroP1CuK3lZZAQals06TZ6T6qcoNukSHpK5w==}
engines: {node: '>=12.11.0'}
'@rollup/pluginutils@5.1.4':
resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==}
engines: {node: '>=14.0.0'}
@ -1713,6 +1743,10 @@ packages:
resolution: {integrity: sha512-4yf0QO/sllf/1zbZWYnvWw3NxCQwLXKzIj0G849LSufP15BXKM0rbD2Z3wVnkMfjdn/CB0Dpp444gYAACdsplg==}
engines: {node: '>=18'}
primevue@4.3.3:
resolution: {integrity: sha512-nooYVoEz5CdP3EhUkD6c3qTdRmpLHZh75fBynkUkl46K8y5rksHTjdSISiDijwTA5STQIOkyqLb+RM+HQ6nC1Q==}
engines: {node: '>=12.11.0'}
proto-list@1.2.4:
resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==}
@ -2550,6 +2584,33 @@ snapshots:
'@polka/url@1.0.0-next.28': {}
'@primeuix/styled@0.5.1':
dependencies:
'@primeuix/utils': 0.5.3
'@primeuix/styles@1.0.1':
dependencies:
'@primeuix/styled': 0.5.1
'@primeuix/themes@1.0.1':
dependencies:
'@primeuix/styled': 0.5.1
'@primeuix/utils@0.5.3': {}
'@primevue/core@4.3.3(vue@3.5.13(typescript@5.8.2))':
dependencies:
'@primeuix/styled': 0.5.1
'@primeuix/utils': 0.5.3
vue: 3.5.13(typescript@5.8.2)
'@primevue/icons@4.3.3(vue@3.5.13(typescript@5.8.2))':
dependencies:
'@primeuix/utils': 0.5.3
'@primevue/core': 4.3.3(vue@3.5.13(typescript@5.8.2))
transitivePeerDependencies:
- vue
'@rollup/pluginutils@5.1.4(rollup@4.37.0)':
dependencies:
'@types/estree': 1.0.6
@ -3779,6 +3840,16 @@ snapshots:
dependencies:
parse-ms: 4.0.0
primevue@4.3.3(vue@3.5.13(typescript@5.8.2)):
dependencies:
'@primeuix/styled': 0.5.1
'@primeuix/styles': 1.0.1
'@primeuix/utils': 0.5.3
'@primevue/core': 4.3.3(vue@3.5.13(typescript@5.8.2))
'@primevue/icons': 4.3.3(vue@3.5.13(typescript@5.8.2))
transitivePeerDependencies:
- vue
proto-list@1.2.4: {}
punycode@2.3.1: {}