diff --git a/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoCreate-AuthorizationTables.sql b/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoCreate-AuthorizationTables.sql
new file mode 100644
index 0000000000..b5f30b485f
--- /dev/null
+++ b/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoCreate-AuthorizationTables.sql
@@ -0,0 +1,34 @@
+--
+-- Title: Create Authorization Status
+-- Database: MySQL InnoDB
+-- Since: V4.1.11 Schema 5156
+-- Author: Pavel Yurkevich
+--
+-- Please contact support@alfresco.com if you need assistance with the upgrade.
+--
+
+CREATE TABLE alf_auth_status
+(
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ username VARCHAR(100) NOT NULL,
+ deleted BIT NOT NULL,
+ authorized BIT NOT NULL,
+ checksum BLOB NOT NULL,
+ authaction VARCHAR(10) NOT NULL,
+ UNIQUE INDEX idx_alf_auth_usr_stat (username, authorized),
+ INDEX idx_alf_auth_action (authaction),
+ INDEX idx_alf_auth_deleted (deleted),
+ PRIMARY KEY (id)
+) ENGINE=InnoDB;
+
+--
+-- Record script finish
+--
+DELETE FROM alf_applied_patch WHERE id = 'patch.db-V4.1-AuthorizationTables';
+INSERT INTO alf_applied_patch
+ (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
+ VALUES
+ (
+ 'patch.db-V4.1-AuthorizationTables', 'Manually executed script upgrade V4.1: Authorization status tables',
+ 0, 6075, -1, 6076, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
+ );
diff --git a/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/Schema-Reference-ALF.xml b/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/Schema-Reference-ALF.xml
index 594ce7c4cf..bdb3ad797f 100644
--- a/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/Schema-Reference-ALF.xml
+++ b/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/Schema-Reference-ALF.xml
@@ -765,6 +765,64 @@
+
+
+
+ bigint
+ false
+ true
+
+
+ varchar(100)
+ false
+ false
+
+
+ bit
+ false
+ false
+
+
+ bit
+ false
+ false
+
+
+ blob
+ false
+ false
+
+
+ varchar(10)
+ false
+ false
+
+
+
+
+ id
+
+
+
+
+
+
+ username
+ authorized
+
+
+
+
+ deleted
+
+
+
+
+ authaction
+
+
+
+
diff --git a/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/AlfrescoCreate-AuthorizationTables.sql b/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/AlfrescoCreate-AuthorizationTables.sql
new file mode 100644
index 0000000000..f7bdfc32e3
--- /dev/null
+++ b/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/AlfrescoCreate-AuthorizationTables.sql
@@ -0,0 +1,35 @@
+--
+-- Title: Create Authorization Status
+-- Database: PostgreSQL
+-- Since: V4.1.11 Schema 5156
+-- Author: Alex Mukha
+--
+-- Please contact support@alfresco.com if you need assistance with the upgrade.
+--
+
+CREATE SEQUENCE alf_auth_status_seq START WITH 1 INCREMENT BY 1;
+CREATE TABLE alf_auth_status
+(
+ id INT8 NOT NULL,
+ username VARCHAR(100) NOT NULL,
+ deleted BOOL NOT NULL,
+ authorized BOOL NOT NULL,
+ checksum BYTEA NOT NULL,
+ authaction VARCHAR(10) NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX idx_alf_auth_usr_stat ON alf_auth_status (username, authorized);
+CREATE INDEX idx_alf_auth_deleted ON alf_auth_status (deleted);
+CREATE INDEX idx_alf_auth_action ON alf_auth_status (authaction);
+
+--
+-- Record script finish
+--
+DELETE FROM alf_applied_patch WHERE id = 'patch.db-V4.1-AuthorizationTables';
+INSERT INTO alf_applied_patch
+ (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
+ VALUES
+ (
+ 'patch.db-V4.1-AuthorizationTables', 'Manually executed script upgrade V4.1: Authorization status tables',
+ 0, 6075, -1, 6076, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
+ );
diff --git a/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml b/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml
index bf569b1662..7bf705eed0 100644
--- a/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml
+++ b/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml
@@ -22,6 +22,7 @@
+
@@ -905,6 +906,64 @@
+
+
+
+ int8
+ false
+ false
+
+
+ varchar(100)
+ false
+ false
+
+
+ bool
+ false
+ false
+
+
+ bool
+ false
+ false
+
+
+ bytea
+ false
+ false
+
+
+ varchar(10)
+ false
+ false
+
+
+
+
+ id
+
+
+
+
+
+ username
+ authorized
+
+
+
+
+ deleted
+
+
+
+
+ authaction
+
+
+
+
+
diff --git a/config/alfresco/dbscripts/db-schema-context.xml b/config/alfresco/dbscripts/db-schema-context.xml
index 4e0bb43e57..94fffab14a 100644
--- a/config/alfresco/dbscripts/db-schema-context.xml
+++ b/config/alfresco/dbscripts/db-schema-context.xml
@@ -22,6 +22,7 @@
classpath:alfresco/dbscripts/create/${db.script.dialect}/AlfrescoCreate-UsageTables.sql
classpath:alfresco/dbscripts/create/${db.script.dialect}/AlfrescoCreate-SubscriptionTables.sql
classpath:alfresco/dbscripts/create/${db.script.dialect}/AlfrescoCreate-TenantTables.sql
+ classpath:alfresco/dbscripts/create/${db.script.dialect}/AlfrescoCreate-AuthorizationTables.sql
@@ -59,6 +60,7 @@
+
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index a5ec062473..9dbaf22043 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -1224,4 +1224,15 @@
+
+
+ patch.db-V4.1-AuthorizationTables
+ patch.schemaUpgradeScript.description
+ 0
+ 9020
+ 9021
+
+ classpath:alfresco/dbscripts/create/${db.script.dialect}/AlfrescoCreate-AuthorizationTables.sql
+
+
diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties
index bba1f9344d..ba76c63264 100644
--- a/config/alfresco/version.properties
+++ b/config/alfresco/version.properties
@@ -23,4 +23,4 @@ version.build=r@scm-revision@-b@build-number@
# Schema number
-version.schema=9020
+version.schema=9021