community-core-procs.tcl

  • last updated 8 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Commit missing change to the users api

added cluster-awareness

NOTE: one should use here the acs-cluster infrastructure instead to

achieve better scalability and easier cache maintenance

When demoting a user, flush the permissions cache as well

fix editing bug

V: ----------------------------------------------------------------------

Fixes for Oracle 19c boolean types in query

This fixes the following bug for Oracle:

: select u.user_id,

: u.authority_id,

: u.username,

: u.screen_name,

: u.priv_name,

: u.priv_email,

: u.email_verified_p,

: u.email_bouncing_p,

: u.no_alerts_until,

: u.last_visit,

: to_char(last_visit, 'YYYY-MM-DD HH24:MI:SS') as last_visit_ansi,

: u.second_to_last_visit,

: to_char(second_to_last_visit, 'YYYY-MM-DD HH24:MI:SS') as second_to_last_visit_ansi,

: u.n_sessions,

: u.password,

: u.salt,

: u.password_question,

: u.password_answer,

: u.password_changed_date,

: extract(day from current_timestamp - password_changed_date) as password_age_days,

: u.auth_token,

: mm.rel_id,

: mr.member_state !>>>!= 'approved' as registered_user_p,

: mr.member_state

: from users u

: left join group_member_map mm on mm.member_id = u.user_id

: and mm.group_id = mm.container_id

: and mm.group_id = :registered_users_group_id

: and mm.rel_type = 'membership_rel'

: left join membership_rels mr on mr.rel_id = mm.rel_id

: where u.user_id = :user_id

Streamline idiom

break overlong lines

Make so that also party::update enforces emails to be lowercase, add/extend automated tests to make sure emails are lowercase everywhere

  1. … 2 more files in changeset.
reduce verbosity

remove race condition from user/person/party cache management

2 new API functions acs_user::promote_person_to_user and acs_user::demote_user (see issue #3461)

acs_user::promote_person_to_user

Promotes a person/party to an ACS user.

@param person_id the person_id in the acs system that should be promoted to a user.

@param username the username to be used for this user.

Defaults to the person's email

@param password the password to be used for this user.

Defaults to a randomly generated password.

@param authority_id the authority that will be used for the user.

@param locale locale to be used in user preferences.

Defaults to the site wide locale is taken.

@return The user_id of the person promoted to user

@error An error is thrown

if the username is already in use,

or the person_id has no email address,

or if person_id is not in the persons table.

acs_user::demote_user

Demotes an ACS user to a person/party.

This will fail if other tables have content referencing the users

table. It is probably best for tables created in other packages

to reference persons, parties, or acs_objects instead. This proc

could be extended with an option to find all referenced tables and

remove rows referencing this user.

See the following FK relationship in basic OpenACS installations:

TABLE "acs_objects" CONSTRAINT "acs_objects_creation_user_fk" FOREIGN KEY (creation_user) REFERENCES users(user_id)

TABLE "acs_objects" CONSTRAINT "acs_objects_modifying_user_fk" FOREIGN KEY (modifying_user) REFERENCES users(user_id)

TABLE "ad_locale_user_prefs" CONSTRAINT "ad_locale_user_prefs_users_fk" FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE

TABLE "auth_batch_job_entries" CONSTRAINT "auth_batch_job_entries_user_fk" FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE SET NULL

TABLE "auth_batch_jobs" CONSTRAINT "auth_batch_jobs_user_fk" FOREIGN KEY (creation_user) REFERENCES users(user_id) ON DELETE SET NULL

TABLE "cr_news" CONSTRAINT "cr_news_approval_user_fk" FOREIGN KEY (approval_user) REFERENCES users(user_id)

TABLE "email_images" CONSTRAINT "email_images_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(user_id)

TABLE "forums_messages" CONSTRAINT "forums_mess_last_poster_fk" FOREIGN KEY (last_poster) REFERENCES users(user_id)

TABLE "forums_messages" CONSTRAINT "forums_mess_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(user_id)

TABLE "forums_reading_info" CONSTRAINT "forums_read_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(user_id)

TABLE "lang_messages_audit" CONSTRAINT "lang_messages_audit_ou_fk" FOREIGN KEY (overwrite_user) REFERENCES users(user_id)

TABLE "lang_messages" CONSTRAINT "lang_messages_creation_user_fk" FOREIGN KEY (creation_user) REFERENCES users(user_id)

TABLE "lang_user_timezone" CONSTRAINT "lang_user_timezone_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE

TABLE "notification_replies" CONSTRAINT "notif_repl_from_fk" FOREIGN KEY (from_user) REFERENCES users(user_id)

TABLE "notification_user_map" CONSTRAINT "notif_user_map_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE

TABLE "notifications" CONSTRAINT "notifications_notif_user_fk" FOREIGN KEY (notif_user) REFERENCES users(user_id)

TABLE "notification_requests" CONSTRAINT "notifications_request_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE

TABLE "proctoring_examination_statement_acceptance" CONSTRAINT "proctoring_examination_statement_acceptance_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE

TABLE "user_portraits" CONSTRAINT "user_portraits_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(user_id)

TABLE "user_preferences" CONSTRAINT "user_preferences_user_id_fk" FOREIGN KEY (user_id) REFERENCES users(user_id)

TABLE "xowiki_tags" CONSTRAINT "xowiki_tags_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(user_id)

  1. … 6 more files in changeset.
Reimplement portrait retrieval around the user_portrait relationship, as procs such as merge::MergeUserInfo do not assume a certain name format on the cr_item

improve spelling

  1. … 1 more file in changeset.
Remove duplicate column

get proper default authority

improve spelling

  1. … 14 more files in changeset.
Cache the portrait in the right cache (Thanks to Felix Mödritscher)

Fix typos

  1. … 11 more files in changeset.
Don't be so quick on deprecating a common interface

Deprecate 'person::update_bio' in favor of 'person::update'

Deprecate 'person::name_flush', unnecessary and used nowhere...

Deprecate 'acs_user::get_element' in favor of 'acs_user::get'

Put get_by_username in the proper cache, handle cases when we delete a user that was not in the cache (in this case we could not retrieve authority and username after deletion)

Fix typo

Unify person update api, exploit cache better and remove unneded queries

  1. … 1 more file in changeset.
No need to check as now person::name won't fail

Fix expression

Parties api had procs defined in both acs-subsite and acs-tcl and sometimes duplicated

- move all party:: api into acs-tcl/tcl/community-core-procs

- remove duplicated definitions

- move leftover deprecated proc to deprecated-procs.tcl

  1. … 4 more files in changeset.
Second revision of the party/person/user api

- split api into 3 caches for party/person/user

- new *_info procs for the specific object type: stresses only specific cache and is therefore faster when only specific info is needed

    • -138
    • +313
    ./community-core-procs.tcl
  1. … 1 more file in changeset.