Permalink
Browse files

Another attempt at #3187

  • Loading branch information...
dmoagx committed Oct 2, 2018
1 parent 51381ca commit 7dbd044edb18aec1d79a51faf0920ab9a8410054
Showing with 12 additions and 7 deletions.
  1. +2 −2 Models/SPUserManager.xcdatamodel/contents
  2. +10 −5 Source/SPUserManager.m
@@ -9,6 +9,7 @@
<attribute name="create_view_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="db" attributeType="String" maxValueString="64" indexed="YES" syncable="YES"/>
<attribute name="delete_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="delete_versioning_rows_priv" optional="YES" attributeType="Boolean" syncable="YES"/>
<attribute name="drop_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="event_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="execute_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
@@ -21,7 +22,6 @@
<attribute name="show_view_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="trigger_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="update_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="delete_history_priv" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="userManager" optional="YES" transient="YES" syncable="YES"/>
<relationship name="user" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="SPUser" inverseName="schema_privileges" inverseEntity="SPUser" indexed="YES" syncable="YES"/>
</entity>
@@ -36,6 +36,7 @@
<attribute name="create_user_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="create_view_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="delete_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="delete_versioning_rows_priv" optional="YES" attributeType="Boolean" syncable="YES"/>
<attribute name="drop_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="event_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="execute_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
@@ -69,7 +70,6 @@
<attribute name="super_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="trigger_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="update_priv" optional="YES" attributeType="Boolean" defaultValueString="NO" syncable="YES"/>
<attribute name="delete_history_priv" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="user" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="userManager" optional="YES" transient="YES" syncable="YES"/>
<relationship name="children" optional="YES" toMany="YES" minCount="1" deletionRule="Cascade" destinationEntity="SPUser" inverseName="parent" inverseEntity="SPUser" indexed="YES" syncable="YES"/>
View
@@ -101,12 +101,17 @@ - (id)init
// is derived automatically. While most keys can be automatically converted without
// any difficulty, some keys differ slightly in mysql column storage to GRANT syntax;
// this dictionary provides mappings for those values to ensure consistency.
// key is: The name of the actual column in the mysql.users / mysql.db table
// value is: The "Privilege" value from "SHOW PRIVILEGES" with " " replaced by "_" and "_priv" appended
privColumnToGrantMap = [@{
@"Grant_priv": @"Grant_option_priv",
@"Show_db_priv": @"Show_databases_priv",
@"Create_tmp_table_priv": @"Create_temporary_tables_priv",
@"Repl_slave_priv": @"Replication_slave_priv",
@"Repl_client_priv": @"Replication_client_priv",
@"Grant_priv": @"Grant_option_priv",
@"Show_db_priv": @"Show_databases_priv",
@"Create_tmp_table_priv": @"Create_temporary_tables_priv",
@"Repl_slave_priv": @"Replication_slave_priv",
@"Repl_client_priv": @"Replication_client_priv",
@"Truncate_versioning_priv": @"Delete_versioning_rows_priv", // MariaDB only, 10.3.4 only
@"Delete_history_priv": @"Delete_versioning_rows_priv", // MariaDB only, since 10.3.5
} retain];
schemas = [[NSMutableArray alloc] init];

0 comments on commit 7dbd044

Please sign in to comment.