Allow LDAP Sources to provide Avatars (#16851)
* Allow LDAP Sources to provide Avatars Add setting to LDAP source to allow it to provide an Avatar. Currently this is required to point to the image bytes. Fix #4144 Signed-off-by: Andrew Thornton <art27@cantab.net> * Rename as Avatar Attribute (drop JPEG) Signed-off-by: Andrew Thornton <art27@cantab.net> * Always synchronize avatar if there is change Signed-off-by: Andrew Thornton <art27@cantab.net> * Actually get the avatar from the ldap Signed-off-by: Andrew Thornton <art27@cantab.net> * clean-up Signed-off-by: Andrew Thornton <art27@cantab.net> * use len()>0 rather than != "" Signed-off-by: Andrew Thornton <art27@cantab.net> * slight shortcut in IsUploadAvatarChanged Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
7e98cd58dd
commit
123f0aea00
13 changed files with 80 additions and 6 deletions
|
@ -45,6 +45,7 @@ func TestAddLdapBindDn(t *testing.T) {
|
|||
"--surname-attribute", "sn-bind full",
|
||||
"--email-attribute", "mail-bind full",
|
||||
"--public-ssh-key-attribute", "publickey-bind full",
|
||||
"--avatar-attribute", "avatar-bind full",
|
||||
"--bind-dn", "cn=readonly,dc=full-domain-bind,dc=org",
|
||||
"--bind-password", "secret-bind-full",
|
||||
"--attributes-in-bind",
|
||||
|
@ -71,6 +72,7 @@ func TestAddLdapBindDn(t *testing.T) {
|
|||
AttributeMail: "mail-bind full",
|
||||
AttributesInBind: true,
|
||||
AttributeSSHPublicKey: "publickey-bind full",
|
||||
AttributeAvatar: "avatar-bind full",
|
||||
SearchPageSize: 99,
|
||||
Filter: "(memberOf=cn=user-group,ou=example,dc=full-domain-bind,dc=org)",
|
||||
AdminFilter: "(memberOf=cn=admin-group,ou=example,dc=full-domain-bind,dc=org)",
|
||||
|
@ -269,6 +271,7 @@ func TestAddLdapSimpleAuth(t *testing.T) {
|
|||
"--surname-attribute", "sn-simple full",
|
||||
"--email-attribute", "mail-simple full",
|
||||
"--public-ssh-key-attribute", "publickey-simple full",
|
||||
"--avatar-attribute", "avatar-simple full",
|
||||
"--user-dn", "cn=%s,ou=Users,dc=full-domain-simple,dc=org",
|
||||
},
|
||||
loginSource: &login.Source{
|
||||
|
@ -288,6 +291,7 @@ func TestAddLdapSimpleAuth(t *testing.T) {
|
|||
AttributeSurname: "sn-simple full",
|
||||
AttributeMail: "mail-simple full",
|
||||
AttributeSSHPublicKey: "publickey-simple full",
|
||||
AttributeAvatar: "avatar-simple full",
|
||||
Filter: "(&(objectClass=posixAccount)(full-simple-cn=%s))",
|
||||
AdminFilter: "(memberOf=cn=admin-group,ou=example,dc=full-domain-simple,dc=org)",
|
||||
RestrictedFilter: "(memberOf=cn=restricted-group,ou=example,dc=full-domain-simple,dc=org)",
|
||||
|
@ -501,6 +505,7 @@ func TestUpdateLdapBindDn(t *testing.T) {
|
|||
"--surname-attribute", "sn-bind full",
|
||||
"--email-attribute", "mail-bind full",
|
||||
"--public-ssh-key-attribute", "publickey-bind full",
|
||||
"--avatar-attribute", "avatar-bind full",
|
||||
"--bind-dn", "cn=readonly,dc=full-domain-bind,dc=org",
|
||||
"--bind-password", "secret-bind-full",
|
||||
"--synchronize-users",
|
||||
|
@ -534,6 +539,7 @@ func TestUpdateLdapBindDn(t *testing.T) {
|
|||
AttributeMail: "mail-bind full",
|
||||
AttributesInBind: false,
|
||||
AttributeSSHPublicKey: "publickey-bind full",
|
||||
AttributeAvatar: "avatar-bind full",
|
||||
SearchPageSize: 99,
|
||||
Filter: "(memberOf=cn=user-group,ou=example,dc=full-domain-bind,dc=org)",
|
||||
AdminFilter: "(memberOf=cn=admin-group,ou=example,dc=full-domain-bind,dc=org)",
|
||||
|
@ -932,6 +938,7 @@ func TestUpdateLdapSimpleAuth(t *testing.T) {
|
|||
"--surname-attribute", "sn-simple full",
|
||||
"--email-attribute", "mail-simple full",
|
||||
"--public-ssh-key-attribute", "publickey-simple full",
|
||||
"--avatar-attribute", "avatar-simple full",
|
||||
"--user-dn", "cn=%s,ou=Users,dc=full-domain-simple,dc=org",
|
||||
},
|
||||
id: 7,
|
||||
|
@ -952,6 +959,7 @@ func TestUpdateLdapSimpleAuth(t *testing.T) {
|
|||
AttributeSurname: "sn-simple full",
|
||||
AttributeMail: "mail-simple full",
|
||||
AttributeSSHPublicKey: "publickey-simple full",
|
||||
AttributeAvatar: "avatar-simple full",
|
||||
Filter: "(&(objectClass=posixAccount)(full-simple-cn=%s))",
|
||||
AdminFilter: "(memberOf=cn=admin-group,ou=example,dc=full-domain-simple,dc=org)",
|
||||
RestrictedFilter: "(memberOf=cn=restricted-group,ou=example,dc=full-domain-simple,dc=org)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue