20120519¶
User permissions¶
Until now I had noticed a few times but silently ignored the fact that the generated lino*.js contains a lot of useless class definitions for normal users. Only the root user needs them all. Whether a user needs a table, depends on the user’s level and on her group memberships. The new permission system started a solution for this. It was very flexible but would it make quite complex when becoming more granular.
So here is the next step into this direction:
New attributes
required_user_groups
and
required_user_level
.
Removed the IntegTable and DebtsUserTable classes which were defined as abstract base classs for tables that are visible only to debts, integ users. It is easier to simply define the above attributes in each table.
Removed lino.core.actions.ViewAction
which was used only
by lino.ui.extjs3.ext_ui.ExtUI.build_site_cache()
.
When generating the site cache, Lino now calls the
new method lino.core.actors.Actor.get_view_permission()
.
Examples (to be completed and covered by unit tests):
lino.apps.pcsw.models.UsersWithClients has two names in
lino.core.actors.Actor.required_user_groups
:required_user_groups = ['integ','newcomers']
That means: it exists only for members of the integ or newcomers group. One membership is enough. A special User level is not required for this table. Even a guest member of one of these groups would see it.
Cache sizes before and after:
2 055 133 lino_root_de.js
1 519 957 lino_caroline_de.js
1 952 055 lino_melanie_de.js
1 952 055 lino_hubert_de.js
1 605 010 lino_kerstin_de.js
2 055 140 lino_root_de.js
1 404 827 lino_caroline_de.js
1 853 767 lino_melanie_de.js
1 741 197 lino_hubert_de.js
1 402 816 lino_kerstin_de.js
Migration¶
Added a little wrapper module lino.apps.dsbe.migrate
needed when loading dumpy fixtures created before Lino 1.4.4.
Adapted lino.apps.pcsw.migrate.migrate_from_1_4_3()
to the
latest changes.
Especially the conversion of existing users is interesting. See the source code for details.
Miscellaneous¶
While playing with the new version on the customer’s site I
noticed the need for a new configuration parameter:
build_js_cache_on_startup
.
outbox.MyOutbox had no phantom record when called from the menu. When called by permalink it had. This was because get_create_kw was called before Actor.setup_request() (which for outbox.MyOutbox sets the master_instance).