   (46, UUID(), 'Theatre', 'Performances', 0, 10, 1),
   (47, UUID(), 'Cinema', 'New blockbusters', 1, 10 ,1),
   (48, UUID(), 'Exhibitions', 'Art', 2, 10 ,1),
-  (49, UUID(), 'Competitions', 'Some sport', 3, 10 ,1);
+  (49, UUID(), 'Competitions', 'Some sport', 3, 10 ,1),
+  (50, UUID(), 'Notification tests', 'All permissions for registered users', 0, 11 ,1),
+  (51, UUID(), 'Invisible Branch', 'used to check permission for admin', 0, 12, null);
+  -- BRANCHES END
 
 -- ****USERS CREATION BEGIN****
 -- Creates a default users with registered/registered, moderator/moderator, banned/banned credentials to be able to log in without manual registration

﻿SET @forum_component_id := 2;
-- Update description of FORUM component for new users baing created
update COMPONENTS set DESCRIPTION = 'Available users: admin/admin registered/registered moderator/moderator banned/banned'
  where CMP_ID = @forum_component_id;

insert ignore into SECTIONS (SECTION_ID, UUID, `NAME`, DESCRIPTION, POSITION, COMPONENT_ID) VALUES

insert ignore into USERS (UUID, USERNAME, ENCODED_USERNAME, EMAIL, PASSWORD, ROLE, SALT, ENABLED) VALUES
  ((SELECT UUID() FROM dual), 'registered', 'registered', 'registered@jtalks.org', MD5('registered'), 'USER_ROLE', '',true),
  ((SELECT UUID() FROM dual), 'moderator', 'moderator', 'moderator@jtalks.org', MD5('moderator'), 'USER_ROLE', '', true),
  ((SELECT UUID() FROM dual), 'banned', 'banned', 'banned@jtalks.org', MD5('banned'), 'USER_ROLE', '', true),
  ((select UUID() from dual), 'post_creator', 'post_creator', 'post_creator@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'sticked_post_creator', 'sticked_post_creator', 'sticked_post_creator@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'announcement_creator', 'announcement_creator', 'announcement_creator@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'ownpost_editor', 'ownpost_editor', 'ownpost_editor@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'otherpost_editor', 'otherpost_editor', 'otherpost_editor@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'ownpost_remover', 'ownpost_remover', 'ownpost_remover@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'otherpost_remover', 'otherpost_remover', 'otherpost_remover@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'topic_mover', 'topic_mover', 'topic_mover@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'topic_closer', 'topic_closer', 'topic_closer@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'codeReview_creator', 'codeReview_creator', 'codeReview_creator@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true),
  ((select UUID() from dual), 'codeReview_commentator', 'codeReview_commentator', 'codeReview_commentator@jtalks.org', MD5('qwerty'), 'USER_ROLE', '',true);
insert ignore into JC_USER_DETAILS (USER_ID, REGISTRATION_DATE, POST_COUNT) values
  ((select ID from USERS where USERNAME = 'registered'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'moderator'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'banned'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'post_creator'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'sticked_post_creator'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'announcement_creator'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'ownpost_editor'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'otherpost_editor'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'ownpost_remover'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'otherpost_remover'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'topic_mover'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'topic_closer'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'codeReview_creator'), NOW(), 0),
  ((select ID from USERS where USERNAME = 'codeReview_commentator'), NOW(), 0);
-- ****USERS CREATION END****

-- Add users to appropriate groups
insert ignore into GROUP_USER_REF select @registered_group_id, ID from USERS;
insert ignore into GROUP_USER_REF select @moderator_group_id, ID from USERS where USERNAME in ('moderator', 'admin');
insert ignore into GROUP_USER_REF select @banned_group_id, ID from USERS where USERNAME = 'banned';
insert ignore into GROUP_USER_REF select @createPosts_group_id, ID from USERS where USERNAME = 'post_creator';
insert ignore into GROUP_USER_REF select @createStickedPosts_group_id, ID from USERS where USERNAME = 'sticked_post_creator';
insert ignore into GROUP_USER_REF select @createAnnouncements_group_id, ID from USERS where USERNAME = 'announcement_creator';
insert ignore into GROUP_USER_REF select @editOwnPosts_group_id, ID from USERS where USERNAME = 'ownpost_editor';
insert ignore into GROUP_USER_REF select @editOtherPosts_group_id, ID from USERS where USERNAME = 'otherpost_editor';
insert ignore into GROUP_USER_REF select @deleteOwnPosts_group_id, ID from USERS where USERNAME = 'ownpost_remover';
insert ignore into GROUP_USER_REF select @deleteOthersPosts_group_id, ID from USERS where USERNAME = 'otherpost_remover';
insert ignore into GROUP_USER_REF select @moveTopics_group_id, ID from USERS where USERNAME = 'topic_mover';
insert ignore into GROUP_USER_REF select @closetopics_group_id, ID from USERS where USERNAME = 'topic_closer';
insert ignore into GROUP_USER_REF select @createCodeReview_group_id, ID from USERS where USERNAME = 'codeReview_creator';
insert ignore into GROUP_USER_REF select @leaveCommentsInCodeReview_group_id, ID from USERS where USERNAME = 'codeReview_commentator';

set @component_acl_class=1;
set @group_acl_class=2;
