446 Commits

Author SHA1 Message Date
skodak
47af2e43f3 MDL-12720 removing confusing/not implemented CONTEXT_PERSONAL; merged from MOODLE_19_STABLE 2007-12-23 19:48:32 +00:00
mjollnir_
7bb03e8a7b merged from MOODLE_19_STABLE: fixing lying phpdoc comments in role_cap_duplicate function that I moved to accesslib yesterday 2007-12-19 23:32:53 +00:00
mjollnir_
d4564cf018 merged from MOODLE_19_STABLE: moving two functions from admin/roles/manage.php (switch_roles and role_cap_duplicate) to accesslib & added phpdoc. Fixes MDL-12621 2007-12-18 20:51:07 +00:00
skodak
d9854bee3f MDL-12602 redirect to course if require_capability() fails for module context; merged from MOODLE_19_STABLE 2007-12-16 13:53:04 +00:00
toyomoyo
6967ba2846 MDL-12544, hide hidden roles in profile when user has no capability 2007-12-12 07:13:09 +00:00
tjhunt
b04ad8649b Take out debugging output in role_assign. It only tells you that something has worked, and everywhere else we use debugging output to warn people they have called an API wrongly. Therefore, this is just confusing now that we trust this bit of roles code. 2007-12-11 10:37:53 +00:00
martinlanghoff
70dd126e0b MDL-12523 accesslib:cleanup_contexts() - Fix invalid SQL syntax and reserved keywords
cleanup_contexts() was not working on Oracle - mostly due to 2 SQL
syntax problems. So probably marginally working elsewhere.

 - We should not use AS when naming table/subselect aliases - only
   when referring to column aliases in the resultset

 - level is a reserved word - oops! - so back to contextlevel
2007-12-10 21:35:58 +00:00
toyomoyo
176058849a MDL-12451, in get_users_by_capability(), defaultroleid bit fixes 2007-12-06 03:57:05 +00:00
tjhunt
36c6f4f59e MDL-12452 - not a fix I fear, just clarifying the comments about how this method is broken. 2007-12-05 17:25:25 +00:00
toyomoyo
086df9283f MDL-12437, sorting by names adds teacher to gradebook list 2007-12-05 01:13:29 +00:00
martinlanghoff
2ff0fb1205 accesslib: build_context_path() remove $temptable for Oracle too
The removal of $temptable was incomplete - and so build_context_path()
was broken on Oracle. MDL-11347
2007-12-04 06:25:25 +00:00
toyomoyo
b1ee7d3a02 MDL-12366, removing useless print_capabilities function 2007-11-28 01:20:59 +00:00
toyomoyo
d2b8b98732 MDL-12309, gradebook can not sort by names while in group mode 2007-11-22 05:17:26 +00:00
martinlanghoff
4f957b116d accesslib: has_capability_in_accessdata() respects rdef locality a bit more
With this patch, we respect rdef locality when two roles
assignments in the same context have conflicting rdefs.
In that case, the most local rdef wins.

So RA locality still matters most. If you are a teacher
sitewide and a student in course X, student role trumps
teacher.

For a use case, see the discussion here
http://moodle.org/mod/forum/discuss.php?d=84472

Notes:

- If we wanted to have locality of RDEF trump everything
  we can. A comment in this patch shows how.

- I don't know how to reproduce this in pure SQL.

And Also:

This patch also fixes a bug where if CAP_PROHIBIT was set
_and_ another role added to it in the same context, we would
add or substract 1 to CAP_PROHIBIT, and it would lose its magic.

And while at it, tighten the code to avoid casts. All the
ints are unambiguously ints.
2007-11-20 00:18:31 +00:00
scyrma
7be3be1bf0 Fix to a bug preventing rss feeds from displaying. 2007-11-16 03:34:05 +00:00
toyomoyo
ba1393b43f MDL-12180, blocks capabilities not appearing when overriding block roles 2007-11-15 07:46:04 +00:00
martinlanghoff
8f9e1d2c4d accesslib: Move check_enrolment_plugins() to complete_user_login()
... where it belongs ;-)

load_all_capabiloties() gets called at several points where we don't
want to be re-querying the enrolment backends. It needs to  be called
before load_all_capabilities() and only by callers that are setting up
a logon session.

Those callers need to be calling complete_user_login() anyway, as they
need to set the Moodle cookie, log the logon action, etc. In fact,
those callers duplicate a lot of that code already.

The callers that don't duplicate code for the login are actually the
cases where the backend enrolment plugins should not be queried.

To be followed by callers cleanup...
2007-11-14 22:04:05 +00:00
nfreear
0dbb2191fb Fixes MDL-12125, Call to a member function FetchRow on a non-object in get_user_access_sitewide. 2007-11-12 16:53:53 +00:00
skodak
5966487712 MDL-11951 a little typo - no recursive call intended in has_any_capability() I guess 2007-10-30 20:51:37 +00:00
tjhunt
3fc3ebf26b MDL-11951 - supplemental - need capability checks in the outer if of the file too. Merged from MOODLE_19_STABLE. 2007-10-30 10:50:20 +00:00
toyomoyo
602654f358 merged fix for MDL-11532, updatesql needs to run after every 'round' otherwises nothing to pull from the context table 2007-10-26 07:58:23 +00:00
stronk7
b738808bb3 Commenting some more debug...
Merged from MOODLE_19_STABLE
2007-10-18 16:04:54 +00:00
stronk7
6100dad06e Commenting out some excess of debug info.
Merged from MOODLE_19_STABLE
2007-10-18 15:57:15 +00:00
toyomoyo
cb8cb8bf88 MDL-11241, adding logs for roles management 2007-10-18 05:53:14 +00:00
skodak
a2cf7f1b8a MDL-11658 shared rdef definition - reduced memory usage in cron 2007-10-17 09:19:39 +00:00
gustav_delius
84dfbdd2f6 Fixed error in the SQL in get_users_by_capability() that made many things not work properly on the course front page. 2007-10-16 08:42:23 +00:00
toyomoyo
13c7c8183e adding missing context 2007-10-12 07:41:30 +00:00
skodak
03cedd6283 MDL-11432 eliminated majority of RecordCount uses, added several missing rs_close() - this should help improve perf on some platforms - Eloy says ;-) 2007-10-10 12:19:27 +00:00
skodak
3f7d592598 add proper rs_close() into cleanup_contexts() - we have to close even when now records returned 2007-10-10 08:43:25 +00:00
skodak
8a4d32d8a3 MDL-11688 makes sure all course and user contexts exist during upgrade (all contexts when going from in 1.6) - this is needed for grade_letter upgrade; other minor tweaks - the USER->access is now loaded automatically, feedback parameters added 2007-10-10 08:33:06 +00:00
nicolasconnault
b7064779f5 Updated copyright notice in header 2007-10-10 05:25:14 +00:00
skodak
b51ece5b3b MDL-11660
* user_lastaccess deleted when deleting course
* rewritten deleting of contexts - does not use get_context_instance() anymore because it is much more strict now
* added deleting of grade_letters and settings when deleting course
2007-10-09 16:07:15 +00:00
skodak
128f098418 MDL-11640
* improved handling of dirty contexts in general - caching, switching in cron, marking, loading, etc.
* role_assing() and role_unassign() now marks dirty contexts because we use has_capability() in this function - we can not do it later outside to speedup bulk operations
* fixed some inline docs
* fixed notice from rs closing
* removed cached $CONTEXT from has_capability() - $context is now required parameter; this was hiding serious bugs when context did not exist or ppl passed false as parameter
* removed some ===, we can not use these on function parameters - we must support ints, strings, '', nulls, etc. - this could be a source of really dangerous bugs in future
* some other improvements and fixes - documented inline
2007-10-09 12:49:54 +00:00
skodak
5c8e6cb179 MDL-11621 removed recursion from create_contexts() 2007-10-05 20:47:08 +00:00
skodak
9a81a6060a MDL-11621 new create_contexts() function that makes sure all contexts exist, optionally initialises the paths and depths too 2007-10-05 20:16:51 +00:00
skodak
7d0c81b3ba MDL-11521 fixed problems when creating contexts and aprents does not exist yet
MDL-11527 fixed warning from $CFG->defaultuserroleid when installing and upgrading
+ removed reusing of previous contexts in has_capability() and get_context_instance()  because it was hiding critical errors when context was false, not specified, etc.
+ tweaked roles defaults - faster and defaults are applied when roles exist
+ SYSCONTEXTID may be specified in config.php to eliminate 1 db query
+ static context cache is now reset after rebuilding of context paths
+ path field in context table is now nullable - pg compatibility requirement
+ other minor fixes
2007-10-05 15:06:38 +00:00
skodak
3d811bc167 MDL-11143 fixed defaultfrongpageroleid typo and fixed notices during install and upgrade cause by undefined $CFG->defaultfrontpageroleid 2007-10-03 14:38:55 +00:00
moodler
2125f23e19 Make sure that the role names gets filtered in get_assignable_roles() 2007-10-03 03:33:57 +00:00
skodak
1f41940f20 MDL-11523 fixed - moving categories and courses around breaks paths and depths in context table + some notice fixes 2007-10-02 22:34:12 +00:00
martinlanghoff
5903fbf5e7 accesslib: dirty context handling now uses cache_flags
get_dirty_contexts() and mark_context_dirty() now use cache_flags
infrastructure. Remove deprecated cleanup_dirty_contexts() - this is
now handled by gc_cache_flags() in a more generic way.
2007-10-02 08:46:27 +00:00
toyomoyo
349a4aea81 fixing a typo 2007-09-27 03:02:01 +00:00
toyomoyo
4d7e30b3d8 modifying get_user_by_capability to handle requests on frontpage courses and sub contexts. MDL-11143 2007-09-27 01:46:41 +00:00
tjhunt
4827029b92 MDL-11454 - hard-coded mdl_ prefix. Also, wrong logic in is_siteadmin in accesslib.php. 2007-09-26 09:40:28 +00:00
toyomoyo
a6df7ee6fa get_default_frontpage_role_access() should prolly not load overrides below course level 2007-09-26 07:19:30 +00:00
toyomoyo
4e1fe7d109 MDL-11143, adding a new setting "defaultfrontpageroleid" where you choose a role for all users on the front page 2007-09-26 07:12:38 +00:00
skodak
a075996572 fixed notice during upgrade from 1.8 2007-09-24 19:00:39 +00:00
stronk7
5cf8d1d9fc temp table usage is out and now we are using the
new permanent context_temp table. Update for
Oracle added, extra NOT EXISTS cluse to avoid
insertion of duplicate records in potential
concurrency and minor refinements. MDL-11347
2007-09-21 08:52:43 +00:00
moodler
7e17f43b1c Just a small change to make this function a bit more robust, there's still a bug here though 2007-09-21 04:33:50 +00:00
skodak
ecbf2954da MDL-11347 adding comments with description of UPDATE related problems; minor whitespace and coding style changes 2007-09-20 07:37:50 +00:00
moodler
bb2c22bda5 I renamed these to help general readability of accesslib:
$ad -> $accessdata
    has_cap_fad ->  has_capability_in_accessdata()
    aggr_roles_fad  -> aggregate_roles_from_accessdata()

Resolves MDL-11173
2007-09-20 04:52:54 +00:00