aboutsummaryrefslogtreecommitdiff
path: root/login.go
diff options
context:
space:
mode:
Diffstat (limited to 'login.go')
-rw-r--r--login.go25
1 files changed, 23 insertions, 2 deletions
diff --git a/login.go b/login.go
index 277e3ae..62a72c1 100644
--- a/login.go
+++ b/login.go
@@ -109,14 +109,21 @@ func NewLdapCon() (*ldap.Conn, error) {
// --- Capabilities ---
type Capabilities struct {
- CanAdmin bool
- CanInvite bool
+ CanAdmin bool
+ CanInvite bool
+ CanUseEmail bool
}
func NewCapabilities(login *LoginStatus, entry *ldap.Entry) *Capabilities {
// Initialize
canAdmin := false
canInvite := false
+ canUseEmail := false
+
+ // Composable logic
+ hasAeroBucketId := false
+ hasAeroBucketName := false
+ hasAeroCryptoRoot := false
// Special case for the "admin" account that is de-facto admin
canAdmin = strings.EqualFold(login.Info.DN(), config.AdminAccount)
@@ -132,12 +139,22 @@ func NewCapabilities(login *LoginStatus, entry *ldap.Entry) *Capabilities {
canAdmin = true
}
}
+ } else if strings.EqualFold(attr.Name, FIELD_AEROGRAMME_CRYPTOROOT) {
+ hasAeroCryptoRoot = true
+ } else if strings.EqualFold(attr.Name, FIELD_AEROGRAMME_BUCKET_ID) {
+ hasAeroBucketId = true
+ } else if strings.EqualFold(attr.Name, FIELD_AEROGRAMME_BUCKET_NAME) {
+ hasAeroBucketName = true
}
}
+ // Boolean logic
+ canUseEmail = hasAeroBucketId && hasAeroBucketName && hasAeroCryptoRoot
+
return &Capabilities{
CanAdmin: canAdmin,
CanInvite: canInvite,
+ CanUseEmail: canUseEmail,
}
}
@@ -173,6 +190,10 @@ func NewLoggedUser(login *LoginStatus) (*LoggedUser, error) {
FIELD_NAME_PROFILE_PICTURE,
FIELD_QUOTA_WEBSITE_SIZE_BURSTED,
FIELD_QUOTA_WEBSITE_COUNT,
+ FIELD_QUOTA_PIM_SIZE_BURSTED,
+ FIELD_AEROGRAMME_CRYPTOROOT,
+ FIELD_AEROGRAMME_BUCKET_ID,
+ FIELD_AEROGRAMME_BUCKET_NAME,
},
nil)