mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Modified to create a default group and give it app rights, instead of the users
This commit is contained in:
parent
fd3ff3ed4f
commit
4125c1f5e7
@ -80,43 +80,71 @@
|
|||||||
$error .= "<br>You must select at least 1 application";
|
$error .= "<br>You must select at least 1 application";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
while ($account = each($account_info)) {
|
// This section is being modified to use the accounts and acl classes soon
|
||||||
// do some checks before we try to import the data
|
// Create a default group
|
||||||
if (!empty($account[1]["account_id"]) && !empty($account[1]["account_lid"]))
|
$defaultgroupid = mt_rand (100, 600000);
|
||||||
@reset($s_apps);
|
$sql = "insert into phpgw_accounts";
|
||||||
while ($app = each($s_apps)) {
|
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
|
||||||
$sql = "DELETE FROM phpgw_acl WHERE acl_appname='".$app[1]."' AND acl_location='run' AND acl_account="
|
$sql .= "values (".$defaultgroupid.", 'Default', 'g', '".md5($passwd)."', 'Default', 'Group', ".time().", 'A')";
|
||||||
. $account[1]["account_id"];
|
$phpgw_setup->db->query($sql);
|
||||||
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
// Give the group access to apps
|
||||||
|
while ($app = each($s_apps)) {
|
||||||
|
$sql = "DELETE FROM phpgw_acl WHERE acl_appname='".$app[1]."' AND acl_location='run' AND acl_account="
|
||||||
|
. $defaultgroupid;
|
||||||
|
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
||||||
|
|
||||||
$sql = "insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)"
|
$sql = "INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)"
|
||||||
. " values('".$app[1]."','run',".$account[1]["account_id"].",1)";
|
. " VALUES('".$app[1]."','run',".$defaultgroupid.",1)";
|
||||||
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
$sql = "DELETE FROM phpgw_acl WHERE acl_appname='admin' AND acl_location='run' AND acl_account="
|
|
||||||
. $account[1]["account_id"];
|
|
||||||
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
|
||||||
|
|
||||||
for ($a=0;$a<count($admins);$a++) {
|
while ($account = each($account_info)) {
|
||||||
if ($admins[$a] == $account[1]["account_id"]) {
|
// do some checks before we try to import the data
|
||||||
$sql = "insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)"
|
if (!empty($account[1]["account_id"]) && !empty($account[1]["account_lid"]))
|
||||||
. " values('admin','run',".$account[1]["account_id"].",1)";
|
/* // This is where each new user was given app rights, instead of per the group
|
||||||
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
@reset($s_apps);
|
||||||
|
while ($app = each($s_apps)) {
|
||||||
|
$sql = "DELETE FROM phpgw_acl WHERE acl_appname='".$app[1]."' AND acl_location='run' AND acl_account="
|
||||||
|
. $account[1]["account_id"];
|
||||||
|
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
||||||
|
|
||||||
|
$sql = "INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)"
|
||||||
|
. " VALUES('".$app[1]."','run',".$account[1]["account_id"].",1)";
|
||||||
|
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
||||||
|
} */
|
||||||
|
|
||||||
|
// Cleanup admin permissions
|
||||||
|
$sql = "DELETE FROM phpgw_acl WHERE acl_appname='admin' AND acl_location='run' AND acl_account="
|
||||||
|
. $account[1]["account_id"];
|
||||||
|
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
||||||
|
|
||||||
|
// Give the user admin only if we asked for them to have it
|
||||||
|
for ($a=0;$a<count($admins);$a++) {
|
||||||
|
if ($admins[$a] == $account[1]["account_id"]) {
|
||||||
|
$sql = "INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)"
|
||||||
|
. " VALUES('admin','run',".$account[1]["account_id"].",1)";
|
||||||
|
$phpgw_setup->db->query($sql ,__LINE__,__FILE__);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$phpgw_setup->db->query("SELECT account_id FROM phpgw_accounts WHERE account_id=" . $account[1]["account_id"]
|
// Actually create the account
|
||||||
. " AND account_lid='" . $account[1]["account_lid"] . "'");
|
$phpgw_setup->db->query("SELECT account_id FROM phpgw_accounts WHERE account_id=" . $account[1]["account_id"]
|
||||||
if(!$phpgw_setup->db->num_rows() && $account[1]["account_lid"]) {
|
. " AND account_lid='" . $account[1]["account_lid"] . "'");
|
||||||
$phpgw_setup->db->query("insert into phpgw_accounts (account_id,account_lid,account_pwd,account_type,"
|
if(!$phpgw_setup->db->num_rows() && $account[1]["account_lid"]) {
|
||||||
. "account_status,account_lastpwd_change) values (" . $account[1]["account_id"] . ",'"
|
$phpgw_setup->db->query("INSERT INTO phpgw_accounts (account_id,account_lid,account_pwd,account_type,"
|
||||||
. $account[1]["account_lid"] . "','x','u','A',".time().")",__LINE__,__FILE__);
|
. "account_status,account_lastpwd_change) VALUES (" . $account[1]["account_id"] . ",'"
|
||||||
}
|
. $account[1]["account_lid"] . "','x','u','A',".time().")",__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
$setup_complete = True;
|
|
||||||
}
|
// Now make them a member of the default group
|
||||||
}
|
$sql = "INSERT INTO phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)"
|
||||||
|
. " VALUES('phpgw_group',".$defaultgroupid.",".$account[1]["account_id"].",'1')";
|
||||||
|
$phpgw_setup->db->query($sql);
|
||||||
|
}
|
||||||
|
$setup_complete = True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add a check to see if there is no users in LDAP, if not create a default user.
|
// Add a check to see if there is no users in LDAP, if not create a default user.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user