calibre-web icon indicating copy to clipboard operation
calibre-web copied to clipboard

Preconfigure ldap before the first start

Open cyberb opened this issue 1 year ago • 14 comments

I am trying to preconfigure ldap before even starting app, for that I have created an init script https://github.com/syncloud/calibre/blob/ldap/config/init.sql

But when I try to login with my ldap username and password it still says user not found and logs do not even mention trying to go to l ldap server is this by design or am I missing something?

WARN {cps.web:1400} Login failed for user "user"

cyberb avatar May 26 '23 19:05 cyberb

The user must be created in the calibre-web database before you can log in as this user

OzzieIsaacs avatar May 26 '23 19:05 OzzieIsaacs

Is user not imported from ldap upon successful authentication? How and when is it imported then (can I trigger it before/after the start in a script)? Is it possible to change so user is automatically created?

cyberb avatar May 26 '23 23:05 cyberb

Just published a proof on concept of how it could be done: https://github.com/janeczku/calibre-web/pull/2799

cyberb avatar May 29 '23 18:05 cyberb

What‘s wrong with this one: https://github.com/janeczku/calibre-web/pull/2628?

OzzieIsaacs avatar May 29 '23 18:05 OzzieIsaacs

right, I have not seen it :) well, must be something wrong as it sits there open for half a year :( ok now you have two, I am not sure if it has role set automatically as when I checked import was doing a user default, but that way you will not have admin users if you start form empty users db (my case)

cyberb avatar May 29 '23 18:05 cyberb

Yeah, nobody is writing tests, as I’ve requested (https://github.com/janeczku/calibre-web/blob/master/CONTRIBUTING.md#contributing-code-to-calibre-web), this is so boring, so everything takes a long time

OzzieIsaacs avatar May 29 '23 18:05 OzzieIsaacs

omg, I really thought there are zero tests as I could not find them, but why are they in a separate repo, are they not supposed to run per commit? should I create two branches and marry them somehow?

cyberb avatar May 29 '23 19:05 cyberb

I think if you merge them in and add some CI like github actions (never used myself as I use drone-ci) for auto run and get a green/red status you could sit back and relax just saying add more tests and make it green :) I have all this for calibre-web as you can see: https://github.com/syncloud/calibre/blob/master/.drone.jsonnet

cyberb avatar May 29 '23 19:05 cyberb

I do not care about about specific python versions and windows as I am packaging a self contained package with no dependencies which should run only on Syncloud Linux device but github actions will probably allow you to do more platforms as you need.

cyberb avatar May 29 '23 19:05 cyberb

I'm not the owner of the calibre-web repro, so I have only limited access to the admin function (e.g. I can't add any github action), and I have no contact to the repro owner (and I dind't try to contact him in the past). So it was easier for me to have it in a seperate repro where I can do whatever I want. The tests I'm running are real system tests including selenium and server simulators where I can stimulate everything I want. The tests are running for more than 5 hours meanwhile, not ideal, but sometimes things are growing... Especially in the beginning this approach was a good one, as most of the routines were just queries to the database and problems were due to missing variables, wrong variable contents and so on in the jinjia2 templates .

OzzieIsaacs avatar May 30 '23 08:05 OzzieIsaacs

I'm not the owner of the calibre-web repo

wow, I see, that explains a lot :) I guess you have some rights at least to push/merge. OK then, I can keep the change on my repo until something similar arrives upstream.

It is sad to see how good open source projects lack a proper maintenance, this is why in Syncloud I am thinking about spreading the income from paid subscribers to app creators as soon as I can cover the running costs in future.

cyberb avatar May 30 '23 08:05 cyberb

I don't want to blame anybody. My time is also limited. From my experience calibre-web attracts a lot of newbies users and system admins but less programmers and there is almost no money to think of what to do with it.

OzzieIsaacs avatar May 30 '23 09:05 OzzieIsaacs

and I dind't try to contact him in the past

Why not? automated CI is the way out of this, if the owner is not involved anymore, a fork is not a bad idea either, still less work than running a manual test after each commit. Even time, converring to unit tests will help as well.

cyberb avatar Jun 04 '23 21:06 cyberb

I didn't check the contributions guide carefully enough, so I didn't know my PR was pending due to the incorrect branch. Apologies :sweat_smile:

I've created a new PR for the develop branch - https://github.com/janeczku/calibre-web/pull/2968

epsilon-0 avatar Jan 04 '24 02:01 epsilon-0