InSync
(InSync)
Fevereiro 20, 2022, 10:17pm
1
Olá
Quero criar um componente (cabeçalho) em um tema que só será visível para um determinado grupo de usuários.
Estou usando este script:
<script type='text/x-handlebars' data-template-name='/connectors/above-main-container/test'>
{{#if currentUser}}
<h1>Olá, {{currentUser.username}}!</h1>
{{/if}}
</script>
Com o que devo substituir este parâmetro {{#if currentUser}} para que apenas usuários do grupo “HackOneGroup” possam ver o componente?
Tentei {{#if group.name === "HackOneGroup"}} mas não funcionou.
Por favor, ajude
IAmGav
(Gavin Perch)
Fevereiro 20, 2022, 10:52pm
2
talvez isso lhe interesse
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 curtidas
Alexander
(Alexander Barrios)
Fevereiro 20, 2022, 11:01pm
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) {
Acho que pode ser semelhante ao que você está procurando
3 curtidas
InSync
(InSync)
Fevereiro 20, 2022, 11:43pm
4
Encontrei este {{#if currentUser.staff}} ele funciona e mostra conteúdo apenas para a equipe, mas não funciona se eu mudar staff para outro, exemplo: {{#if currentUser.trust_level_0}}