Skip to content

Commit 7dbd044

Browse files
committed
Another attempt at #3187
1 parent 51381ca commit 7dbd044

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

Models/SPUserManager.xcdatamodel/contents

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<attribute name="create_view_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
1010
<attribute name="db" attributeType="String" maxValueString="64" indexed="YES" syncable="YES"/>
1111
<attribute name="delete_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
12+
<attribute name="delete_versioning_rows_priv" optional="YES" attributeType="Boolean" syncable="YES"/>
1213
<attribute name="drop_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
1314
<attribute name="event_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
1415
<attribute name="execute_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
@@ -21,7 +22,6 @@
2122
<attribute name="show_view_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
2223
<attribute name="trigger_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
2324
<attribute name="update_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
24-
<attribute name="delete_history_priv" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
2525
<attribute name="userManager" optional="YES" transient="YES" syncable="YES"/>
2626
<relationship name="user" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="SPUser" inverseName="schema_privileges" inverseEntity="SPUser" indexed="YES" syncable="YES"/>
2727
</entity>
@@ -36,6 +36,7 @@
3636
<attribute name="create_user_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
3737
<attribute name="create_view_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
3838
<attribute name="delete_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
39+
<attribute name="delete_versioning_rows_priv" optional="YES" attributeType="Boolean" syncable="YES"/>
3940
<attribute name="drop_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
4041
<attribute name="event_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
4142
<attribute name="execute_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
@@ -69,7 +70,6 @@
6970
<attribute name="super_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
7071
<attribute name="trigger_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
7172
<attribute name="update_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
72-
<attribute name="delete_history_priv" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
7373
<attribute name="user" optional="YES" attributeType="String" syncable="YES"/>
7474
<attribute name="userManager" optional="YES" transient="YES" syncable="YES"/>
7575
<relationship name="children" optional="YES" toMany="YES" minCount="1" deletionRule="Cascade" destinationEntity="SPUser" inverseName="parent" inverseEntity="SPUser" indexed="YES" syncable="YES"/>

Source/SPUserManager.m

+10-5
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,17 @@ - (id)init
101101
// is derived automatically. While most keys can be automatically converted without
102102
// any difficulty, some keys differ slightly in mysql column storage to GRANT syntax;
103103
// this dictionary provides mappings for those values to ensure consistency.
104+
105+
// key is: The name of the actual column in the mysql.users / mysql.db table
106+
// value is: The "Privilege" value from "SHOW PRIVILEGES" with " " replaced by "_" and "_priv" appended
104107
privColumnToGrantMap = [@{
105-
@"Grant_priv": @"Grant_option_priv",
106-
@"Show_db_priv": @"Show_databases_priv",
107-
@"Create_tmp_table_priv": @"Create_temporary_tables_priv",
108-
@"Repl_slave_priv": @"Replication_slave_priv",
109-
@"Repl_client_priv": @"Replication_client_priv",
108+
@"Grant_priv": @"Grant_option_priv",
109+
@"Show_db_priv": @"Show_databases_priv",
110+
@"Create_tmp_table_priv": @"Create_temporary_tables_priv",
111+
@"Repl_slave_priv": @"Replication_slave_priv",
112+
@"Repl_client_priv": @"Replication_client_priv",
113+
@"Truncate_versioning_priv": @"Delete_versioning_rows_priv", // MariaDB only, 10.3.4 only
114+
@"Delete_history_priv": @"Delete_versioning_rows_priv", // MariaDB only, since 10.3.5
110115
} retain];
111116

112117
schemas = [[NSMutableArray alloc] init];

0 commit comments

Comments
 (0)