fix: Domain admin can see domain in home
This commit is contained in:
parent
8a7e644960
commit
38700ee4cb
3 changed files with 15 additions and 9 deletions
|
|
@ -42,7 +42,7 @@ impl<D: DatabaseInterface> Database<D> {
|
||||||
.list_all_domains()
|
.list_all_domains()
|
||||||
.await?
|
.await?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|d| user.role.can_see_domain(&d.name))
|
.filter(|d| user.can_see_domain(&d.name))
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,12 @@ impl User {
|
||||||
pub fn can_create_domain(&self) -> bool {
|
pub fn can_create_domain(&self) -> bool {
|
||||||
self.role.can_perform(&Operation::CreateDomain)
|
self.role.can_perform(&Operation::CreateDomain)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn can_see_domain(&self, domain: &str) -> bool {
|
||||||
|
let allowed = self.role.can_see_domain(domain);
|
||||||
|
tracing::debug!("{} can see domain {}: {}", self.mail, domain, allowed);
|
||||||
|
allowed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for User {
|
impl fmt::Display for User {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
<button type="submit" class="button is-info">Create</button>
|
<button type="submit" class="button is-info">Create</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div>
|
<div>
|
||||||
<h2>Active domains you can see</h2>
|
<h2>Active domains you can see</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
@ -22,7 +23,6 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% if other_users %}
|
{% if other_users %}
|
||||||
<div>
|
<div>
|
||||||
<h2>Other users you have permission to see on your own domain</h2>
|
<h2>Other users you have permission to see on your own domain</h2>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue