This commit is contained in:
Raymond Hackley 2025-11-28 13:37:51 +00:00 committed by GitHub
commit 3287babbcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 80 additions and 2 deletions

View file

@ -65,5 +65,6 @@ For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc)
<settings>
<admin>OCA\Passman\Settings\Admin</admin>
<admin-section>OCA\Passman\Settings\AdminSection</admin-section>
</settings>
</info>

12
img/app-dark.svg Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 68 68" enable-background="new 0 0 68 68" xml:space="preserve">
<g>
<path d="M0,34c0,21.9,30,34,34,34c4,0,34-12.1,34-34V0H0V34z M45.4,50.3H22.6v-6.5h22.8V50.3z M21.6,16.2
c0,0,6.5,2.4,9.2,4.1c-0.6-2.6-1.2-10-1.2-10h8.6c0,0-0.6,7.8-1.2,10c1.2-0.6,9.4-4.1,9.4-4.1l2.7,8.3c0,0-7.5,1.8-10.1,1.9
c1.8,1.4,6.7,7.4,6.7,7.4l-7,5.3c0,0-3.8-6.3-5-8.9c-1.2,2.9-5,8.9-5,8.9l-7.2-5.3c0,0,5.7-6.3,7.1-7.4c-1.4-0.1-9.9-1.9-9.9-1.9
L21.6,16.2z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 835 B

View file

@ -46,7 +46,7 @@ class SettingsController extends ApiController {
* @return string the section ID, e.g. 'sharing'
*/
public function getSection() {
return 'additional';
return 'passman';
}
/**

View file

@ -23,6 +23,7 @@
namespace OCA\Passman;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use OCP\Notification\INotification;
use OCP\Notification\INotifier;
@ -31,6 +32,7 @@ class Notifier implements INotifier {
public function __construct(
protected IFactory $factory,
protected IURLGenerator $url,
) {
}
@ -47,6 +49,11 @@ class Notifier implements INotifier {
// Read the language from the notification
$l = $this->factory->get('passman', $languageCode);
// Set the icon for the notification
$notification->setIcon(
$this->url->getAbsoluteURL($this->url->imagePath('passman', 'app-dark.svg'))
);
switch ($notification->getSubject()) {
// Deal with known subjects
case 'credential_expired':

View file

@ -95,7 +95,7 @@ class Admin implements ISettings {
* @return string
*/
public function getSection(): string {
return 'additional';
return 'passman';
}
/**

View file

@ -0,0 +1,58 @@
<?php
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Passman\Settings;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;
class AdminSection implements IIconSection {
public function __construct(
private string $appName,
private IURLGenerator $url,
private IL10N $l,
) {
}
/**
* returns the ID of the section. It is supposed to be a lower case string,
* e.g. 'ldap'
*
* @returns string
*/
public function getID() {
return $this->appName;
}
/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
*/
public function getName() {
return $this->l->t('Passman');
}
/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*
* E.g.: 70
*/
public function getPriority() {
return 70;
}
/**
* {@inheritdoc}
*/
public function getIcon() {
return $this->url->imagePath($this->appName, 'app-dark.svg');
}
}