InSync
(InSync)
20. Februar 2022 um 22:17
1
Hey
Ich möchte eine Komponente (Header) in einem Theme erstellen, die nur für eine bestimmte Benutzergruppe sichtbar ist.
Ich verwende dieses Skript:
<script type='text/x-handlebars' data-template-name='/connectors/above-main-container/test'>
{{#if currentUser}}
<h1>Hallo, {{currentUser.username}}!</h1>
{{/if}}
</script>
Was soll ich durch diesen Parameter {{#if currentUser}} ersetzen, damit nur Benutzer aus der Gruppe „HackOneGroup“ die Komponente sehen können?
Ich habe versucht: {{#if group.name === \"HackOneGroup\"}}, aber es funktioniert nicht.
Bitte hilf mir
IAmGav
(Gavin Perch)
20. Februar 2022 um 22:52
2
Vielleicht interessiert Sie das
This component lets you render any topic as a banner on custom url paths.
The default look is pretty basic. The screenshot shows the default Welcome topic as a banner on the Latest list:
[Screenshot from 2022-01-27 14-42-15]
But banners will render various content that is supported on topics, e.g. emojis, animations, video links… So you could use (and abuse) this in many ways
In Settings, you select views by their relative url and topics by their id. You can also position the …
3 „Gefällt mir“
Alexander
(Alexander Barrios)
20. Februar 2022 um 23:01
3
const setups = parseSetups(settings.topic_banners);
createWidget("topic-banners", {
tagName: "div.topic-banner-container",
html() {
const router = getOwner(this).lookup("router:main");
const url = router.currentURL;
if (settings.show_to_group) {
const currentUser = getOwner(this).lookup("current-user:main");
if (currentUser == null) return;
else {
const hasGroup = currentUser.groups.any((g) => g.name === settings.show_to_group);
if (hasGroup == false) return;
}
}
if (settings.show_to_visitors) {
const currentUser = getOwner(this).lookup("current-user:main");
if (currentUser !== null) return;
}
if (settings.show_url) {
Ich glaube, das könnte dem ähneln, was Sie suchen
3 „Gefällt mir“
InSync
(InSync)
20. Februar 2022 um 23:43
4
Ich habe dies gefunden {{#if currentUser.staff}}, es funktioniert und zeigt Inhalte nur für das Personal an, aber es funktioniert nicht, wenn ich staff in etwas anderes ändere, Beispiel: {{#if currentUser.trust_level_0}}