Sfoglia il codice sorgente

! Profile permissions tweaks on install and upgrade

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 11 anni fa
parent
commit
6aee92d119

+ 10 - 1
other/install_2-1_mysql.sql

@@ -1487,7 +1487,6 @@ INSERT INTO {$db_prefix}permissions
 VALUES (-1, 'search_posts'),
 	(-1, 'calendar_view'),
 	(-1, 'view_stats'),
-	(-1, 'profile_view_any'),
 	(0, 'view_mlist'),
 	(0, 'search_posts'),
 	(0, 'profile_view_own'),
@@ -1500,6 +1499,11 @@ VALUES (-1, 'search_posts'),
 	(0, 'view_stats'),
 	(0, 'who_view'),
 	(0, 'profile_identity_own'),
+	(0, 'profile_password_own'),
+	(0, 'profile_blurb_own'),
+	(0, 'profile_displayed_name_own'),
+	(0, 'profile_signature_own'),
+	(0, 'profile_other_own'),
 	(0, 'profile_extra_own'),
 	(0, 'profile_remove_own'),
 	(0, 'profile_server_avatar'),
@@ -1519,6 +1523,11 @@ VALUES (-1, 'search_posts'),
 	(2, 'view_stats'),
 	(2, 'who_view'),
 	(2, 'profile_identity_own'),
+	(2, 'profile_password_own'),
+	(2, 'profile_blurb_own'),
+	(2, 'profile_displayed_name_own'),
+	(2, 'profile_signature_own'),
+	(2, 'profile_other_own'),
 	(2, 'profile_extra_own'),
 	(2, 'profile_remove_own'),
 	(2, 'profile_server_avatar'),

+ 10 - 1
other/install_2-1_postgresql.sql

@@ -1937,7 +1937,6 @@ CREATE TABLE {$db_prefix}permissions (
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'search_posts');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'calendar_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'view_stats');
-INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'profile_view_any');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'view_mlist');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'search_posts');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_view_own');
@@ -1950,6 +1949,11 @@ INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'calendar_
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'view_stats');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'who_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_identity_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_password_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_blurb_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_displayed_name_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_signature_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_other_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_extra_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_remove_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_server_avatar');
@@ -1969,6 +1973,11 @@ INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'calendar_
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'view_stats');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'who_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_identity_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_password_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_blurb_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_displayed_name_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_signature_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_other_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_extra_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_remove_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_server_avatar');

+ 10 - 1
other/install_2-1_sqlite.sql

@@ -1613,7 +1613,6 @@ BEGIN TRANSACTION;
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'search_posts');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'calendar_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'view_stats');
-INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'profile_view_any');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'view_mlist');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'search_posts');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_view_own');
@@ -1626,6 +1625,11 @@ INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'calendar_
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'view_stats');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'who_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_identity_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_password_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_blurb_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_displayed_name_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_signature_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_other_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_extra_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_remove_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_server_avatar');
@@ -1645,6 +1649,11 @@ INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'calendar_
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'view_stats');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'who_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_identity_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_password_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_blurb_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_displayed_name_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_signature_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_other_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_extra_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_remove_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_server_avatar');

+ 10 - 1
other/install_2-1_sqlite3.sql

@@ -1613,7 +1613,6 @@ BEGIN TRANSACTION;
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'search_posts');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'calendar_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'view_stats');
-INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'profile_view_any');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'view_mlist');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'search_posts');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_view_own');
@@ -1626,6 +1625,11 @@ INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'calendar_
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'view_stats');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'who_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_identity_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_password_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_blurb_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_displayed_name_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_signature_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_other_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_extra_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_remove_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_server_avatar');
@@ -1645,6 +1649,11 @@ INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'calendar_
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'view_stats');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'who_view');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_identity_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_password_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_blurb_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_displayed_name_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_signature_own');
+INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_other_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_extra_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_remove_own');
 INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_server_avatar');

+ 62 - 0
other/upgrade_2-1_mysql.sql

@@ -504,4 +504,66 @@ $get_questions = upgrade_query("
 ---# Updating log_packages
 UPDATE {$db_prefix}log_packages
 SET install_state = 0;
+---#
+
+/******************************************************************************/
+--- Updating profile permissions...
+/******************************************************************************/
+---# Adding "profile_password_own"
+---{
+$inserts = array();
+
+$request = upgrade_query("
+	SELECT id_group, add_deny
+	FROM {$db_prefix}permissions
+	WHERE permission = 'profile_identity_own'");
+	
+	while ($row = $smcFunc['db_fetch_assoc']($get_questions))
+	{
+		$inserts[] = "($row[id_group], 'profile_password_own', $row[add_deny])";
+	}
+
+	$smcFunc['db_free_result']($request);
+
+	if (!empty($inserts))
+	{
+		upgrade_query("
+			INSERT INTO {$db_prefix}permissions
+				(id_group, permission, add_deny)
+			VALUES
+				" . implode(',', $inserts));
+		}
+	}
+---}
+---#
+
+---# Adding other profile permissions
+---{
+$inserts = array();
+
+$request = upgrade_query("
+	SELECT id_group, add_deny
+	FROM {$db_prefix}permissions
+	WHERE permission = 'profile_extra_own'");
+	
+	while ($row = $smcFunc['db_fetch_assoc']($get_questions))
+	{
+		$inserts[] = "($row[id_group], 'profile_blurb_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_displayed_name_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_forum_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_other_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_signature_own', $row[add_deny])";
+	}
+
+	$smcFunc['db_free_result']($request);
+
+	if (!empty($inserts))
+	{
+		upgrade_query("
+			INSERT INTO {$db_prefix}permissions
+				(id_group, permission, add_deny)
+			VALUES
+				" . implode(',', $inserts));
+	}
+---}
 ---#

+ 67 - 0
other/upgrade_2-1_postgresql.sql

@@ -578,4 +578,71 @@ ALTER TABLE {$db_prefix}log_online ALTER ip TYPE bigint;
 ---# Updating log_packages
 UPDATE {$db_prefix}log_packages
 SET install_state = 0;
+---#
+
+/******************************************************************************/
+--- Updating profile permissions...
+/******************************************************************************/
+---# Adding "profile_password_own"
+---{
+$inserts = array();
+
+$request = upgrade_query("
+	SELECT id_group, add_deny
+	FROM {$db_prefix}permissions
+	WHERE permission = 'profile_identity_own'");
+	
+	while ($row = $smcFunc['db_fetch_assoc']($get_questions))
+	{
+		$inserts[] = "($row[id_group], 'profile_password_own', $row[add_deny])";
+	}
+
+	$smcFunc['db_free_result']($request);
+
+	if (!empty($inserts))
+	{
+		foreach ($inserts as $insert)
+		{
+			upgrade_query("
+				INSERT INTO {$db_prefix}permissions
+					(id_group, permission, add_deny)
+				VALUES
+					" . $insert);
+		}
+	}
+---}
+---#
+
+---# Adding other profile permissions
+---{
+$inserts = array();
+
+$request = upgrade_query("
+	SELECT id_group, add_deny
+	FROM {$db_prefix}permissions
+	WHERE permission = 'profile_extra_own'");
+	
+	while ($row = $smcFunc['db_fetch_assoc']($get_questions))
+	{
+		$inserts[] = "($row[id_group], 'profile_blurb_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_displayed_name_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_forum_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_other_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_signature_own', $row[add_deny])";
+	}
+
+	$smcFunc['db_free_result']($request);
+
+	if (!empty($inserts))
+	{
+		foreach ($inserts as $insert)
+		{
+			upgrade_query("
+				INSERT INTO {$db_prefix}permissions
+					(id_group, permission, add_deny)
+				VALUES
+					" . $insert);
+		}
+	}
+---}
 ---#

+ 67 - 0
other/upgrade_2-1_sqlite.sql

@@ -561,4 +561,71 @@ CREATE TABLE IF NOT EXISTS {$db_prefix}qanda (
 ---# Updating log_packages
 UPDATE {$db_prefix}log_packages
 SET install_state = 0;
+---#
+
+/******************************************************************************/
+--- Updating profile permissions...
+/******************************************************************************/
+---# Adding "profile_password_own"
+---{
+$inserts = array();
+
+$request = upgrade_query("
+	SELECT id_group, add_deny
+	FROM {$db_prefix}permissions
+	WHERE permission = 'profile_identity_own'");
+	
+	while ($row = $smcFunc['db_fetch_assoc']($get_questions))
+	{
+		$inserts[] = "($row[id_group], 'profile_password_own', $row[add_deny])";
+	}
+
+	$smcFunc['db_free_result']($request);
+
+	if (!empty($inserts))
+	{
+		foreach ($inserts as $insert)
+		{
+			upgrade_query("
+				INSERT INTO {$db_prefix}permissions
+					(id_group, permission, add_deny)
+				VALUES
+					" . $insert);
+		}
+	}
+---}
+---#
+
+---# Adding other profile permissions
+---{
+$inserts = array();
+
+$request = upgrade_query("
+	SELECT id_group, add_deny
+	FROM {$db_prefix}permissions
+	WHERE permission = 'profile_extra_own'");
+	
+	while ($row = $smcFunc['db_fetch_assoc']($get_questions))
+	{
+		$inserts[] = "($row[id_group], 'profile_blurb_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_displayed_name_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_forum_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_other_own', $row[add_deny])";
+		$inserts[] = "($row[id_group], 'profile_signature_own', $row[add_deny])";
+	}
+
+	$smcFunc['db_free_result']($request);
+
+	if (!empty($inserts))
+	{
+		foreach ($inserts as $insert)
+		{
+			upgrade_query("
+				INSERT INTO {$db_prefix}permissions
+					(id_group, permission, add_deny)
+				VALUES
+					" . $insert);
+		}
+	}
+---}
 ---#