Apply validation rules for loaded settings.

def validate(self):
        """Apply validation rules for loaded settings."""
        if self.GROUP_ATTRIBUTES and self.GROUPNAME_FIELD not in self.GROUP_ATTRIBUTES.values():
            raise ImproperlyConfigured("LDAP_SYNC_GROUP_ATTRIBUTES must contain '%s'" % self.GROUPNAME_FIELD)

        if not self.model._meta.get_field(self.USERNAME_FIELD).unique:
            raise ImproperlyConfigured("LDAP_SYNC_USERNAME_FIELD '%s' must be unique" % self.USERNAME_FIELD)

        if self.USER_ATTRIBUTES and self.USERNAME_FIELD not in self.USER_ATTRIBUTES.values():
            raise ImproperlyConfigured("LDAP_SYNC_USER_ATTRIBUTES must contain '%s'" % self.USERNAME_FIELD)