Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
f6d648a0
Commit
f6d648a0
authored
Nov 12, 2008
by
Nigel McNie
Browse files
Add support for marking groups as ones that users should be automatically added to.
The UI for this still needs to be implemented.
parent
fc89251a
Changes
5
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/db/install.xml
View file @
f6d648a0
...
...
@@ -266,6 +266,7 @@
<FIELD
NAME=
"ctime"
TYPE=
"datetime"
NOTNULL=
"true"
/>
<FIELD
NAME=
"mtime"
TYPE=
"datetime"
NOTNULL=
"true"
/>
<FIELD
NAME=
"public"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"0"
/>
<FIELD
NAME=
"usersautoadded"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"0"
/>
<FIELD
NAME=
"deleted"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"0"
/>
</FIELDS>
<KEYS>
...
...
htdocs/lib/db/upgrade.php
View file @
f6d648a0
...
...
@@ -1457,6 +1457,16 @@ function xmldb_core_upgrade($oldversion=0) {
set_field
(
'grouptype_roles'
,
'see_submitted_views'
,
1
,
'grouptype'
,
'course'
,
'role'
,
'admin'
);
}
if
(
$oldversion
<
2008111200
)
{
// Event subscription for auto adding users to groups
insert_record
(
'event_subscription'
,
(
object
)
array
(
'event'
=>
'createuser'
,
'callfunction'
=>
'add_user_to_autoadd_groups'
));
$table
=
new
XMLDBTable
(
'group'
);
$field
=
new
XMLDBField
(
'usersautoadded'
);
$field
->
setAttributes
(
XMLDB_TYPE_INTEGER
,
1
,
null
,
XMLDB_NOTNULL
,
null
,
null
,
null
,
0
);
add_field
(
$table
,
$field
);
}
return
$status
;
}
...
...
htdocs/lib/upgrade.php
View file @
f6d648a0
...
...
@@ -669,6 +669,10 @@ function core_install_firstcoredata_defaults() {
'event'
=>
'createuser'
,
'callfunction'
=>
'activity_set_defaults'
,
),
array
(
'event'
=>
'createuser'
,
'callfunction'
=>
'add_user_to_autoadd_groups'
,
),
);
foreach
(
$subs
as
$sub
)
{
...
...
htdocs/lib/user.php
View file @
f6d648a0
...
...
@@ -1208,6 +1208,25 @@ function copy_view_for_user($userid, $templateid) {
}
/**
* Given a user, makes sure they have been added to all groups that are marked
* as ones that users should be auto-added to
*
* @param array $eventdata Event data passed from activity_occured, the key 'id' = userid
*/
function
add_user_to_autoadd_groups
(
$eventdata
)
{
require_once
(
'group.php'
);
$userid
=
$eventdata
[
'id'
];
if
(
$autoaddgroups
=
get_column
(
'group'
,
'id'
,
'usersautoadded'
,
true
))
{
foreach
(
$autoaddgroups
as
$groupid
)
{
if
(
!
group_user_access
(
$groupid
,
$userid
))
{
group_add_user
(
$groupid
,
$userid
);
}
}
}
}
function
copy_views_for_user
(
$userid
,
$templateids
)
{
if
(
!
$templateids
)
{
return
;
...
...
htdocs/lib/version.php
View file @
f6d648a0
...
...
@@ -27,7 +27,7 @@
defined
(
'INTERNAL'
)
||
die
();
$config
=
new
StdClass
;
$config
->
version
=
2008111
102
;
$config
->
version
=
2008111
200
;
$config
->
release
=
'1.1.0beta3dev'
;
$config
->
minupgradefrom
=
2007080700
;
$config
->
minupgraderelease
=
'0.8.0 (release tag 0.8.0_RELEASE)'
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment