703 Commits

Author SHA1 Message Date
moodler
024f3f9749 accesslib MDL-19730 fixing regression from MDL-19077 where has_capability fails when $USER->id=0 (so they couldn't see blocks etc) 2009-07-07 07:06:19 +00:00
tjhunt
8a9c1c1c2d Add a warning that require_capabiliy can only be used before output is started. 2009-07-04 14:22:11 +00:00
tjhunt
c84a2dbea2 MDL-19077 - change how $OUTPUT is initialised.
Please read the comment at the top of bootstrap_renderer in setuplib.php
2009-06-29 05:00:45 +00:00
tjhunt
31a9987770 install: MDL-19610 encapsulate empty($CFG->rolesactive) checks in a during_initial_install() function. 2009-06-24 09:17:56 +00:00
skodak
17da2e6f28 MDL-16438 centralise information about plugins to avoid duplication, includes local customisation conversion to standard plugin structure + fixes for some recent regressions; see tracker for more details and links to docs and forums discussions 2009-06-19 14:25:56 +00:00
stronk7
f59309921b MDL-19465 accesslib - improve get_user_access_sitewide() performance (~10%) 2009-06-16 15:34:55 +00:00
skodak
a8f3a651c0 MDL-18293 removed obsoleted checking of return values from insert and update_record + unused strings cleanup 2009-06-13 18:16:08 +00:00
skodak
bb4b6010f3 MDL-18293 removed obsoleted checking of return values from insert and update_record + unused strings cleanup 2009-06-13 17:17:10 +00:00
skodak
bf8e93d704 MDL-18293 $DB->somethiong is using exceptions, no need for ifs tehre, removing useless strings 2009-06-03 20:00:08 +00:00
skodak
56f3599bb9 MDL-19288 fixed limiting cached context - array_shift() was breaking array keys; merged from MOODLE_19_STABLE 2009-05-23 20:08:48 +00:00
samhemelryk
cc3edaa47c accesslib.php MDL-19236 added phpdocs and copyrights 2009-05-22 02:03:55 +00:00
samhemelryk
d9ff0cc96e accesslib MDL-19237 corrected non existent fields 2009-05-19 08:02:55 +00:00
samhemelryk
46808d7ccc accesslib MDL-19236 added phpdocs and copyrights 2009-05-19 07:50:54 +00:00
skodak
5ca3c8386f MDL-19184, MDL-19212 - refactoring, cleanup and improvements in text editors support; localization support is not finished, inline docs incomplete, expect more commits soon 2009-05-16 20:53:21 +00:00
stronk7
0974051307 MDL-18746 get_user_courses_bycap() - avoid ambiguous (repeated) column names ; merged from 19_STABLE 2009-05-11 00:04:18 +00:00
tjhunt
e03c0c1d49 blocklib: MDL-19010 fix editing block config and block roles. 2009-05-08 07:47:50 +00:00
tjhunt
f474a4e583 blocks: MDL-19010 Fix further blocks-related breakage, including removing all references to blocks_insance_old outside blocklib.php 2009-05-07 08:55:10 +00:00
tjhunt
9d1d606e0d blocklib: MDL-19010 fix new install.
* Fix the blocks bit of build_context_path
* Replace blocks_repopulate_page
* Make starting_output work during setup
2009-05-07 07:05:22 +00:00
tjhunt
6bf44482c6 pagelib: MDL-12212 eliminate quiz_page 2009-05-06 09:24:45 +00:00
tjhunt
93d4a373f9 blocklib: MDL-19010 always include blocklib in setup.php, stip includes elsewhere 2009-05-06 09:13:16 +00:00
tjhunt
66b10689e2 blocklib: MDL-19010 upgrade database tables ready for now blocks system 2009-05-06 09:12:03 +00:00
skodak
8ead7b5983 MDL-19009 cleanup - there is no CONTEXT_GROUP and pinned block context 2009-05-04 20:23:20 +00:00
tjhunt
9434fef401 filters: MDL-18879 filter data not deleted when a context is deleted
Missed when implementing MDL-7336

Also, fix minor issues with deleting filters
2009-04-17 02:49:07 +00:00
sam_marshall
4d10247fdb MDL-18768: Limited size of context and modinfo caches to avoid memory problems with code that loops through many courses, also changed forum role_assign to use recordset for all-courses loops 2009-04-06 09:48:39 +00:00
sam_marshall
48f9c073ca MDL-18094: course/viewhiddenactivities didn't work (in some parts of the code) at module level 2009-04-02 16:32:12 +00:00
tjhunt
c468795ce9 switch roles: MDL-18132 New Role allow switches page finished.
I also set up a reasonable set of default allows, including setting up some sensible allow_overrides, whatever the rant in MDL-15841 says.
2009-03-25 04:20:57 +00:00
tjhunt
82701e2443 switch roles: MDL-18132 separate database table role_allow_switch instead of re-using role_allow_assign.
This is part 1 that does the back-end:

1. New table role_allow_switch.
2. Upgrade that copies all the allows from role_allow_assign, and then drops the old CFG->allowuserswitchrolestheycantassign.
3. Old function get_assignable_roles_for_switchrole renamed to get_switchable_roles and changed to use the new table. Fixes MDL-18604 in HEAD.
4. Switch callers to use the new function name.
5. Unit tests for this new function.
6. To make those unit tests work, new switch_global_user_id and revert_global_user_id methods in UnitTestCaseUsingDatabase for toggling $USER->id.

I still need to do the editing interface under Administration ► Users ► Permissions ► Define roles. That will be done as a second commit.
2009-03-23 08:15:21 +00:00
tjhunt
ffdd703a99 MDL-18637 fix Moodle 1.9-style {$CFG->prefix}tablename in HEAD, and a few missing $DB->s.
I did not fix all the DB problems in search, there are too many there for me to be prepared to clean up other people's mess.

(For once, it was not me making this mistake ;-))
2009-03-23 05:19:53 +00:00
tjhunt
d867e696aa accesslib: MDL-18620 do not used static to cache things, it makes unit testing impossible.
Instead we have a new $ACCESSLIB_PRIVATE for all caching. Regrettably, the only way to make this work in PHP (other than rewriting everything to be methods of a class rather than functions) is to make this a global variable. However $ACCESSLIB_PRIVATE should not be thought of a global, it is a private implementation detail of accesslib.php. (And there is a comment saying that.)

There is a new function accesslib_clear_all_caches_for_unit_testing(). In a unit test, you need to call this at the start of your test method, before you set up any test data, and again at the end, after you have discarded all your test data.

This new $ACCESSLIB_PRIVATE subsumes the old $ACCESS, $RDEFS and $DITRYCONTEXTS globals.

Also, I took the opportunity to refactor the (inconsistently) duplicated code for adding a context to the caches code into a cache_context function.
2009-03-23 03:54:50 +00:00
stronk7
004865e20d MDL-15748 get_user_access_sitewide() - reduce looking for perms in any context below category level.
Dramatic speed-up in sites with zillions of contexts and overrides. Credit goes to Samuli Karevaara.
Merged from 19_STABLE
2009-03-20 12:10:47 +00:00
tjhunt
ea26b22262 accesslib. Improve comment. 2009-03-20 07:41:49 +00:00
skodak
795a08adb7 MDL-17458 upgrade logging implemented + a lot more refactoring + exceptions implemented in install/upgrade code + lang pack cleanup + some more improvements 2009-01-31 20:07:32 +00:00
skodak
88582df496 MDL-17458 refactored guest and admin user creation + refactored roles install + added protection for installation hijacking + added reliable session test right before editting of admin account 2009-01-29 22:54:41 +00:00
skodak
19a4a32e53 MDL-17942 fixed some incorrect uses of exceptions and typos 2009-01-17 23:24:31 +00:00
skodak
ac173d3ebe MDL-17267 simplified create_role - not adding assign and override perm to admin accounts, they have it now always 2009-01-17 23:16:20 +00:00
skodak
18818abf4c MDL-17458 $CFG->rolesactive cleanup + other cleanup in upgrade code 2009-01-15 22:09:57 +00:00
tjhunt
fb35c0cf72 accesslib: Nice debug developer warning if you call get_users_with_capability without including u.id in the list of fields. 2009-01-14 04:44:20 +00:00
skodak
1045a0074c MDL-17849 sql queries not printed by default during upgrade anymore, there is a new config.php only setting $CFG->upgradeshowsql instead 2009-01-12 16:52:53 +00:00
skodak
5c144d605e MDL-17845 now only one page per installs/upgrade :-D 2009-01-12 15:13:44 +00:00
tjhunt
4e7fabe6d6 accesslib: MDL-17626 role_names not cleaned up when a context is deleted. 2009-01-09 05:25:50 +00:00
skodak
a91b910e4f MDL-17776 added new define CLI_SCRIPT that identifies all CLI scripts + cron (cli scripts do not have session and do not like HTML in output and are executed from command line, cron is an exception) 2009-01-03 14:28:02 +00:00
skodak
b7b64ff2e0 MDL-17754 next round of session related refactoring 2009-01-02 20:32:05 +00:00
skodak
d993468db0 MDL-17556 fixed whitespace 2008-12-30 16:29:38 +00:00
mjollnir_
0e4e1a43f1 MDL-17693: get_role_users - add lastaccess & mnethostid to the list of default fields to return. These are used by messaging/emailing. (Merged from MOODLE_19_STABLE) 2008-12-19 08:56:25 +00:00
mjollnir_
a65cfba54d MDL-17692: count_role_users now accepts an int or an array of ints for roleid - this is now consistent with get_role_users. (Merged from MOODLE_19_STABLE) 2008-12-19 08:45:44 +00:00
sam_marshall
00653161b5 MDL-17556: Improve performance of get_fast_modinfo when courses have many activities 2008-12-18 17:52:29 +00:00
stronk7
294c03a996 MDL-17647 accesslib - cleaning some candoanything in comments. Merged from 19_STABLE 2008-12-17 00:33:32 +00:00
tjhunt
212235d3e2 accesslib: MDL-17647, MDL-17648 and MDL-17649 Bug fix, improvement and unit test.
MDL-17647 was referring to moodle/site:candoanything insstead of moodle/site:doanything

MDL-17648 Let get_users_by_capability take an array of capabilities, like has_any_capability

MDL-17649 get_users_by_capability must have unit tests (HEAD only).

The unit tests were briefly working (apart from the system context, which I had to set up by hand in the test contexts table). Then I made the mistake of trying to upgrade the test tables, and it all went horribly wrong (MDL-17644).
2008-12-15 06:22:18 +00:00
skodak
1a5b427e44 MDL-17589 fixed handling of missing caps in admin tree; merged from MOODLE_19_STABLE 2008-12-12 10:50:25 +00:00
dongsheng
771dc7b298 "MDL-14129, fix error() in moodle2" 2008-12-12 05:45:43 +00:00