martinlanghoff [Sun, 6 Jan 2008 23:24:25 +0000 (23:24 +0000)]
accesslib: get_user_by_capability() - Move capcheck to has_capability_from_rarc()
This fixes the handling of default roles as "tie breakers" for lower
RAs in conflict, and simplifies the code a lot.
The main loop in get_user_by_capability() runs a simpler state machine
that just collects role assignments (roleid and depth), and handles
pagination.
The complex part of the state machine has moved to
has_capability_from_rarc() which will walk the data structures
collected by get_user_by_capability() for each user.
Having all the complex state handling of $hascap there makes things a
lot easier for pagination and general sanity of
get_user_by_capability().
martinlanghoff [Sun, 6 Jan 2008 23:24:14 +0000 (23:24 +0000)]
accesslib: get_user_by_capability() - Move hidden RA checks to subselect
we don't deal with RAs in the main SELECT -- we deal with _capabilities_
which is an entirely different matter ;-) -- so push the ra.hidden check
into the subselect.
Also, remove ra.hidden from the default list of fields. Hopefully no
callers are using ra.hidden -- if they are, they should be calling
something else, as this function deals with capabilities. So we might
need an audit of callers, to check that noone is expecting ra.hidden
to be there.
martinlanghoff [Sun, 6 Jan 2008 23:23:58 +0000 (23:23 +0000)]
accesslib: get_user_by_capability() - Handle the complex case
With this commit, we can handle the complex cases with
- correct pagination, but not very efficient over large datasets
- mostly-correct application of the override rules
The structure of the code is fairly complex in that we want to do
it without holding all the recs in memory, so we use a small state
machine. We have to handle the complex override rules over 1 or 2
permissions (when $doanything is set) so it all ends up quite complex.
There is one known issue with this code, in cases where the default
role ends up as the decider between 2 conflicting RAs, we fail to
apply it. This will need a bit of reorg of how the loop works.
With this patch, get_user_by_capability() can handle the cases where
users have multiple role assignments to the same course, and PREVENTs
and PROHIBITs affect the rolecaps of this course.
Without stored procedures we cannot resolve this entirely on the
server side - so in the complex cases we do as much as we can on SQL,
and post-process the data on the PHP side, including SQL-style
pagination.
This patch reorganises the conditions and field handling so
we can spot if this is a call we can resolve in a single SQL
query that we just pass back the results.
If there are any PREVENTs or PROHIBITs, we need to delve into
more involved stuff...
martinlanghoff [Sun, 6 Jan 2008 22:46:20 +0000 (22:46 +0000)]
dmllib:rcache_get()/rcache_set() clone cached records - we do not want magic references here - MDL-12827\n And calling fullclone() with the huge cost in serialize()/unserialize() is not needed.
skodak [Tue, 1 Jan 2008 15:51:54 +0000 (15:51 +0000)]
MDL-12790 highlighting in admin search results breaks html
MDL-12791 add defaults parameter to format_admin_setting()
MDL-12792 search in admin settings and defaults
+ minor speedup of fast highlighting and fixed empty span tags
skodak [Mon, 31 Dec 2007 15:37:12 +0000 (15:37 +0000)]
MDL-12782 magpie now uses download_file_content() - that should solve several remote RSS issues including proxy user/password + several download_file_content() improvements + other minor fixes; merged from MOODLE_19_STABLE
skodak [Sun, 30 Dec 2007 19:42:51 +0000 (19:42 +0000)]
MDL-11845 removing curl emulation library, snoopy has better support for proxies and seems to be more reliable on different platforms; spelling correction cURL instead of Curl; adding all proxy admin settings; better debug messages for file downloading; SOCKS5 proxy support; merged from MOODLE_19_STABLE
poltawski [Sat, 29 Dec 2007 20:31:10 +0000 (20:31 +0000)]
MDL-9925 - When a user presses cancel on restore they are sent to
/admin/. For teachers this gives an ugly access denied message,
so instead send them back to the course they came from.
poltawski [Sat, 29 Dec 2007 20:03:03 +0000 (20:03 +0000)]
MDL-12763 - proxy_url() in langimport was doing its own custom proxied
download magic. Convert to use download_file_contents() for more
robust downloads. And also add a more helpful error message while i'm
at it.
merged from MOODLE_19_STABLE
mchurch [Fri, 28 Dec 2007 17:14:01 +0000 (17:14 +0000)]
MDL-12703 - Use the 'welcometocourse' language string if there is no 'welcomemessage' property set in the course object. Currently, there does not seem to be any code or data items that would set this property.