Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: SonarQube

on:
pull_request:
push:
branches:
- master

jobs:
sonarqube:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
- name: SonarQube Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
22 changes: 12 additions & 10 deletions lib/Service/NotificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@
use OCP\Notification\IManager;

class NotificationService {
public const APP_URL_PREFIX = 'index.php/apps/' . Application::APP_ID;

public function __construct(
private IManager $manager,
private IURLGenerator $urlGenerator,
private IDBConnection $db,
) {
}

function credentialExpiredNotification($credential, $link) {
$api = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'index.php/apps/' . Application::APP_ID));
public function credentialExpiredNotification($credential, $link) {
$api = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', self::APP_URL_PREFIX));
$notification = $this->manager->createNotification();
$remindAction = $notification->createAction();
$remindAction->setLabel('remind')
Expand All @@ -62,9 +64,9 @@ function credentialExpiredNotification($credential, $link) {
}


function credentialSharedNotification($data) {
$link = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'index.php/apps/' . Application::APP_ID . '/#/'));
$api = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'index.php/apps/' . Application::APP_ID));
public function credentialSharedNotification($data) {
$link = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', self::APP_URL_PREFIX . '/#/'));
$api = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', self::APP_URL_PREFIX));
$notification = $this->manager->createNotification();

$declineAction = $notification->createAction();
Expand All @@ -83,7 +85,7 @@ function credentialSharedNotification($data) {
}


function credentialDeclinedSharedNotification($data) {
public function credentialDeclinedSharedNotification($data) {
$notification = $this->manager->createNotification();
$notification->setApp(Application::APP_ID)
->setUser($data['target_user'])
Expand All @@ -94,7 +96,7 @@ function credentialDeclinedSharedNotification($data) {
}


function credentialAcceptedSharedNotification($data) {
public function credentialAcceptedSharedNotification($data) {
$notification = $this->manager->createNotification();
$notification->setApp(Application::APP_ID)
->setUser($data['target_user'])
Expand All @@ -104,7 +106,7 @@ function credentialAcceptedSharedNotification($data) {
$this->manager->notify($notification);
}

function hasCredentialExpirationNotification($credential): bool {
public function hasCredentialExpirationNotification($credential): bool {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from('notifications')
Expand All @@ -113,15 +115,15 @@ function hasCredentialExpirationNotification($credential): bool {
return $qb->executeQuery()->rowCount() !== 0;
}

function deleteNotificationsOfCredential($credential) {
public function deleteNotificationsOfCredential($credential) {
$qb = $this->db->getQueryBuilder();
$qb->delete('notifications')
->where($qb->expr()->eq('object_id', $qb->createNamedParameter($credential->getId(), IQueryBuilder::PARAM_INT)))
->andWhere($qb->expr()->eq('object_type', $qb->createNamedParameter('credential', IQueryBuilder::PARAM_STR)));
return $qb->executeStatement();
}

function markNotificationOfCredentialAsProcessed(int $credential_id, string $user_id): void {
public function markNotificationOfCredentialAsProcessed(int $credential_id, string $user_id): void {
$notification = $this->manager->createNotification();
$notification->setApp(Application::APP_ID)
->setObject('credential', $credential_id)
Expand Down
8 changes: 0 additions & 8 deletions sass/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,11 @@
background: none;
background-position-x: 0%;
background-position-y: 0%;
background-repeat: repeat;
background-image: none;
background-size: auto;
background-image: var(--icon-triangle-s-dark);
background-size: 16px;
background-repeat: no-repeat;
background-position: center;
border: none;
border-radius: 0;
outline: none !important;
box-shadow: none;
content: " ";
Expand All @@ -273,10 +269,6 @@
#app-navigation:not(.vue) > ul > li > .app-navigation-entry-bullet + a, #app-navigation:not(.vue) > ul > li > ul > li > .app-navigation-entry-bullet + a {
background: rgba(0,0,0,0) !important;
}
#app-navigation:not(.vue) > ul > li > a.svg, #app-navigation:not(.vue) > ul > li > ul > li > a.svg {
padding: 0 12px 0 44px;
padding-left: 44px;
}
#app-navigation:not(.vue) > ul > li > .app-navigation-entry-bullet, #app-navigation:not(.vue) > ul > li > ul > li > .app-navigation-entry-bullet {
position: absolute;
display: block;
Expand Down
1 change: 0 additions & 1 deletion sass/public-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ header {
}

.credential_field {
/* overflow: hidden; */
display: flex;
flex-wrap: wrap;
align-items: center;
Expand Down
10 changes: 10 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sonar.projectKey=Passman
sonar.qualitygate.wait=true
sonar.sources=./
sonar.exclusions=./l10n,./tests,./css
sonar.language=php

sonar.issue.ignore.multicriteria=e1
# Ignore "Hard-coded credentials are security-sensitive"
sonar.issue.ignore.multicriteria.e1.ruleKey=javascript:S2068
sonar.issue.ignore.multicriteria.e1.resourceKey=l10n/*