From f2adb7dfac9f321c6a94acb6c647caa3f7218094 Mon Sep 17 00:00:00 2001 From: Azareal Date: Thu, 18 Feb 2021 21:40:42 +1000 Subject: [PATCH] add AutoLink permission eliminate pointless arithmetic in the parser possible fix for creating group promotions add AutoLink phrase --- cmd/query_gen/main.go | 18 +++++----- common/parser.go | 9 +++-- common/permissions.go | 23 ++++++------ langs/english.json | 1 + routes/panel/groups.go | 75 ++++++++++++++++++++-------------------- schema/mssql/inserts.sql | 6 ++-- schema/mysql/inserts.sql | 6 ++-- schema/pgsql/inserts.sql | 6 ++-- 8 files changed, 77 insertions(+), 67 deletions(-) diff --git a/cmd/query_gen/main.go b/cmd/query_gen/main.go index e01b33d2..a4a0c5b1 100644 --- a/cmd/query_gen/main.go +++ b/cmd/query_gen/main.go @@ -127,6 +127,7 @@ func seedTables(a qgen.Adapter) error { UseConvosOnlyWithMod CreateProfileReply AutoEmbed + AutoLink // CreateConvo ? // CreateConvoReply ? @@ -144,7 +145,7 @@ func seedTables(a qgen.Adapter) error { MoveTopic */ - p := func(perms c.Perms) string { + p := func(perms *c.Perms) string { jBytes, err := json.Marshal(perms) if err != nil { panic(err) @@ -162,7 +163,7 @@ func seedTables(a qgen.Adapter) error { if banned { bi = "1" } - qgen.Install.SimpleInsert("users_groups", "name, permissions, plugin_perms, is_mod, is_admin, is_banned, tag", `'`+name+`','`+p(perms)+`','{}',`+mi+`,`+ai+`,`+bi+`,"`+tag+`"`) + qgen.Install.SimpleInsert("users_groups", "name, permissions, plugin_perms, is_mod, is_admin, is_banned, tag", `'`+name+`','`+p(&perms)+`','{}',`+mi+`,`+ai+`,`+bi+`,"`+tag+`"`) } perms := c.AllPerms @@ -170,10 +171,10 @@ func seedTables(a qgen.Adapter) error { perms.EditGroupAdmin = false addGroup("Administrator", perms, true, true, false, "Admin") - perms = c.Perms{BanUsers: true, ActivateUsers: true, EditUser: true, EditUserEmail: false, EditUserGroup: true, ViewIPs: true, UploadFiles: true, UploadAvatars: true, UseConvos: true, UseConvosOnlyWithMod: true, CreateProfileReply: true, AutoEmbed: true, ViewTopic: true, LikeItem: true, CreateTopic: true, EditTopic: true, DeleteTopic: true, CreateReply: true, EditReply: true, DeleteReply: true, PinTopic: true, CloseTopic: true, MoveTopic: true} + perms = c.Perms{BanUsers: true, ActivateUsers: true, EditUser: true, EditUserEmail: false, EditUserGroup: true, ViewIPs: true, UploadFiles: true, UploadAvatars: true, UseConvos: true, UseConvosOnlyWithMod: true, CreateProfileReply: true, AutoEmbed: true, AutoLink: true, ViewTopic: true, LikeItem: true, CreateTopic: true, EditTopic: true, DeleteTopic: true, CreateReply: true, EditReply: true, DeleteReply: true, PinTopic: true, CloseTopic: true, MoveTopic: true} addGroup("Moderator", perms, true, false, false, "Mod") - perms = c.Perms{UploadFiles: true, UploadAvatars: true, UseConvos: true, UseConvosOnlyWithMod: true, CreateProfileReply: true, AutoEmbed: true, ViewTopic: true, LikeItem: true, CreateTopic: true, CreateReply: true} + perms = c.Perms{UploadFiles: true, UploadAvatars: true, UseConvos: true, UseConvosOnlyWithMod: true, CreateProfileReply: true, AutoEmbed: true, AutoLink: true, ViewTopic: true, LikeItem: true, CreateTopic: true, CreateReply: true} addGroup("Member", perms, false, false, false, "") perms = c.Perms{ViewTopic: true} @@ -190,6 +191,10 @@ func seedTables(a qgen.Adapter) error { // + /*var addForumPerm = func(gid, fid int, permStr string) { + qgen.Install.SimpleInsert("forums_permissions", "gid, fid, permissions", strconv.Itoa(gid)+`,`+strconv.Itoa(fid)+`,'`+permStr+`'`) + }*/ + qgen.Install.SimpleInsert("forums_permissions", "gid, fid, permissions", `1,1,'{"ViewTopic":true,"CreateReply":true,"CreateTopic":true,"PinTopic":true,"CloseTopic":true}'`) qgen.Install.SimpleInsert("forums_permissions", "gid, fid, permissions", `2,1,'{"ViewTopic":true,"CreateReply":true,"CloseTopic":true}'`) qgen.Install.SimpleInsert("forums_permissions", "gid, fid, permissions", "3,1,'{}'") @@ -257,9 +262,6 @@ func seedTables(a qgen.Adapter) error { fSet = append(fSet, "'"+table+"'") } qgen.Install.SimpleBulkInsert("tables", "name", fSet)*/ - /*for _, table := range tables { - qgen.Install.SimpleInsert("tables", "name", "'"+table+"'") - }*/ return nil } @@ -324,7 +326,7 @@ func writeDeletes(a qgen.Adapter) error { //b.Delete("deleteForumPermsByForum").Table("forums_permissions").Where("fid=?").Parse() - b.Delete("deleteActivityStreamMatch").Table("activity_stream_matches").Where("watcher = ? AND asid = ?").Parse() + b.Delete("deleteActivityStreamMatch").Table("activity_stream_matches").Where("watcher=? AND asid=?").Parse() //b.Delete("deleteActivityStreamMatchesByWatcher").Table("activity_stream_matches").Where("watcher=?").Parse() return nil diff --git a/common/parser.go b/common/parser.go index edbfd0e4..2c074223 100644 --- a/common/parser.go +++ b/common/parser.go @@ -632,7 +632,8 @@ func ParseMessage2(msg string, sectionID int, sectionType string, settings *Pars i-- case 'h', 'f', 'g', '/': //fmt.Println("s3") - if len(msg) > i+5 && msg[i+1] == 't' && msg[i+2] == 't' && msg[i+3] == 'p' { + fch := msg[i+1] + if len(msg) > i+5 && fch == 't' && msg[i+2] == 't' && msg[i+3] == 'p' { if len(msg) > i+6 && msg[i+4] == 's' && msg[i+5] == ':' && msg[i+6] == '/' { // Do nothing } else if msg[i+4] == ':' && msg[i+5] == '/' { @@ -641,7 +642,6 @@ func ParseMessage2(msg string, sectionID int, sectionType string, settings *Pars continue } } else if len(msg) > i+4 { - fch := msg[i+1] if fch == 't' && msg[i+2] == 'p' && msg[i+3] == ':' && msg[i+4] == '/' { // Do nothing } else if fch == 'i' && msg[i+2] == 't' && msg[i+3] == ':' && msg[i+4] == '/' { @@ -651,11 +651,14 @@ func ParseMessage2(msg string, sectionID int, sectionType string, settings *Pars } else { continue } - } else if msg[i+1] == '/' { + } else if fch == '/' { // Do nothing } else { continue } + if !user.Perms.AutoLink { + continue + } //fmt.Println("p1:",i) sb.WriteString(msg[lastItem:i]) diff --git a/common/permissions.go b/common/permissions.go index d07b218a..1e14d61d 100644 --- a/common/permissions.go +++ b/common/permissions.go @@ -43,6 +43,7 @@ var GlobalPermList = []string{ "UseConvosOnlyWithMod", "CreateProfileReply", "AutoEmbed", + "AutoLink", } // Permission Structure: ActionComponent[Subcomponent]Flag @@ -69,12 +70,13 @@ type Perms struct { ViewIPs bool `json:",omitempty"` // Global non-staff permissions - UploadFiles bool `json:",omitempty"` - UploadAvatars bool `json:",omitempty"` - UseConvos bool `json:",omitempty"` + UploadFiles bool `json:",omitempty"` + UploadAvatars bool `json:",omitempty"` + UseConvos bool `json:",omitempty"` UseConvosOnlyWithMod bool `json:",omitempty"` - CreateProfileReply bool `json:",omitempty"` - AutoEmbed bool `json:",omitempty"` + CreateProfileReply bool `json:",omitempty"` + AutoEmbed bool `json:",omitempty"` + AutoLink bool `json:",omitempty"` // Forum permissions ViewTopic bool `json:",omitempty"` @@ -128,12 +130,13 @@ func init() { ViewAdminLogs: true, ViewIPs: true, - UploadFiles: true, - UploadAvatars: true, - UseConvos: true, + UploadFiles: true, + UploadAvatars: true, + UseConvos: true, UseConvosOnlyWithMod: true, - CreateProfileReply: true, - AutoEmbed: true, + CreateProfileReply: true, + AutoEmbed: true, + AutoLink: true, ViewTopic: true, LikeItem: true, diff --git a/langs/english.json b/langs/english.json index 2a5f1eab..e32ea5aa 100644 --- a/langs/english.json +++ b/langs/english.json @@ -34,6 +34,7 @@ "UseConvosOnlyWithMod":"Can use conversations only to contact global mods", "CreateProfileReply": "Can create profile replies", "AutoEmbed":"Automatically embed media they post", + "AutoLink":"Linkify their links", "ViewTopic": "Can view topics", "LikeItem": "Can like items", diff --git a/routes/panel/groups.go b/routes/panel/groups.go index 3463b68b..7ee90442 100644 --- a/routes/panel/groups.go +++ b/routes/panel/groups.go @@ -183,58 +183,58 @@ func groupCheck(w http.ResponseWriter, r *http.Request, u *c.User, g *c.Group, e return nil } -func GroupsPromotionsCreateSubmit(w http.ResponseWriter, r *http.Request, user *c.User, sgid string) c.RouteError { - if !user.Perms.EditGroup { - return c.NoPermissions(w, r, user) +func GroupsPromotionsCreateSubmit(w http.ResponseWriter, r *http.Request, u *c.User, sgid string) c.RouteError { + if !u.Perms.EditGroup { + return c.NoPermissions(w, r, u) } gid, err := strconv.Atoi(sgid) if err != nil { - return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, user) + return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, u) } from, err := strconv.Atoi(r.FormValue("from")) if err != nil { - return c.LocalError("from must be integer", w, r, user) + return c.LocalError("from must be integer", w, r, u) } to, err := strconv.Atoi(r.FormValue("to")) if err != nil { - return c.LocalError("to must be integer", w, r, user) + return c.LocalError("to must be integer", w, r, u) } if from == to { - return c.LocalError("the from group and to group cannot be the same", w, r, user) + return c.LocalError("the from group and to group cannot be the same", w, r, u) } twoWay := r.FormValue("two-way") == "1" level, err := strconv.Atoi(r.FormValue("level")) if err != nil { - return c.LocalError("level must be integer", w, r, user) + return c.LocalError("level must be integer", w, r, u) } posts, err := strconv.Atoi(r.FormValue("posts")) if err != nil { - return c.LocalError("posts must be integer", w, r, user) + return c.LocalError("posts must be integer", w, r, u) } - regHours, err := strconv.Atoi(r.FormValue("registered_hours")) + regHours, err := strconv.Atoi(r.FormValue("reg_hours")) if err != nil { - return c.LocalError("registered_hours must be integer", w, r, user) + return c.LocalError("reg_hours must be integer", w, r, u) } - regDays, err := strconv.Atoi(r.FormValue("registered_days")) + regDays, err := strconv.Atoi(r.FormValue("reg_days")) if err != nil { - return c.LocalError("registered_days must be integer", w, r, user) + return c.LocalError("reg_days must be integer", w, r, u) } - regMonths, err := strconv.Atoi(r.FormValue("registered_months")) + regMonths, err := strconv.Atoi(r.FormValue("reg_months")) if err != nil { - return c.LocalError("registered_months must be integer", w, r, user) + return c.LocalError("reg_months must be integer", w, r, u) } regMinutes := (regHours * 60) + (regDays * 24 * 60) + (regMonths * 30 * 24 * 60) g, err := c.Groups.Get(from) - ferr := groupCheck(w, r, user, g, err) + ferr := groupCheck(w, r, u, g, err) if err != nil { return ferr } g, err = c.Groups.Get(to) - ferr = groupCheck(w, r, user, g, err) + ferr = groupCheck(w, r, u, g, err) if err != nil { return ferr } @@ -242,7 +242,7 @@ func GroupsPromotionsCreateSubmit(w http.ResponseWriter, r *http.Request, user * if err != nil { return c.InternalError(err, w, r) } - err = c.AdminLogs.Create("create", pid, "group_promotion", user.GetIP(), user.ID) + err = c.AdminLogs.Create("create", pid, "group_promotion", u.GetIP(), u.ID) if err != nil { return c.InternalError(err, w, r) } @@ -251,37 +251,37 @@ func GroupsPromotionsCreateSubmit(w http.ResponseWriter, r *http.Request, user * return nil } -func GroupsPromotionsDeleteSubmit(w http.ResponseWriter, r *http.Request, user *c.User, sspl string) c.RouteError { - if !user.Perms.EditGroup { - return c.NoPermissions(w, r, user) +func GroupsPromotionsDeleteSubmit(w http.ResponseWriter, r *http.Request, u *c.User, sspl string) c.RouteError { + if !u.Perms.EditGroup { + return c.NoPermissions(w, r, u) } spl := strings.Split(sspl, "-") if len(spl) < 2 { - return c.LocalError("need two params", w, r, user) + return c.LocalError("need two params", w, r, u) } gid, err := strconv.Atoi(spl[0]) if err != nil { - return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, user) + return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, u) } pid, err := strconv.Atoi(spl[1]) if err != nil { - return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, user) + return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, u) } pro, err := c.GroupPromotions.Get(pid) if err == sql.ErrNoRows { - return c.LocalError("That group promotion doesn't exist", w, r, user) + return c.LocalError("That group promotion doesn't exist", w, r, u) } else if err != nil { return c.InternalError(err, w, r) } g, err := c.Groups.Get(pro.From) - ferr := groupCheck(w, r, user, g, err) + ferr := groupCheck(w, r, u, g, err) if err != nil { return ferr } g, err = c.Groups.Get(pro.To) - ferr = groupCheck(w, r, user, g, err) + ferr = groupCheck(w, r, u, g, err) if err != nil { return ferr } @@ -289,7 +289,7 @@ func GroupsPromotionsDeleteSubmit(w http.ResponseWriter, r *http.Request, user * if err != nil { return c.InternalError(err, w, r) } - err = c.AdminLogs.Create("delete", pid, "group_promotion", user.GetIP(), user.ID) + err = c.AdminLogs.Create("delete", pid, "group_promotion", u.GetIP(), u.ID) if err != nil { return c.InternalError(err, w, r) } @@ -298,17 +298,17 @@ func GroupsPromotionsDeleteSubmit(w http.ResponseWriter, r *http.Request, user * return nil } -func GroupsEditPerms(w http.ResponseWriter, r *http.Request, user *c.User, sgid string) c.RouteError { - basePage, ferr := buildBasePage(w, r, user, "edit_group", "groups") +func GroupsEditPerms(w http.ResponseWriter, r *http.Request, u *c.User, sgid string) c.RouteError { + basePage, ferr := buildBasePage(w, r, u, "edit_group", "groups") if ferr != nil { return ferr } - if !user.Perms.EditGroup { - return c.NoPermissions(w, r, user) + if !u.Perms.EditGroup { + return c.NoPermissions(w, r, u) } gid, err := strconv.Atoi(sgid) if err != nil { - return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, user) + return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, u) } g, err := c.Groups.Get(gid) @@ -318,11 +318,11 @@ func GroupsEditPerms(w http.ResponseWriter, r *http.Request, user *c.User, sgid } else if err != nil { return c.InternalError(err, w, r) } - if g.IsAdmin && !user.Perms.EditGroupAdmin { - return c.LocalError(p.GetErrorPhrase("panel_groups_cannot_edit_admin"), w, r, user) + if g.IsAdmin && !u.Perms.EditGroupAdmin { + return c.LocalError(p.GetErrorPhrase("panel_groups_cannot_edit_admin"), w, r, u) } - if g.IsMod && !user.Perms.EditGroupSuperMod { - return c.LocalError(p.GetErrorPhrase("panel_groups_cannot_edit_supermod"), w, r, user) + if g.IsMod && !u.Perms.EditGroupSuperMod { + return c.LocalError(p.GetErrorPhrase("panel_groups_cannot_edit_supermod"), w, r, u) } // TODO: Load the phrases in bulk for efficiency? @@ -355,6 +355,7 @@ func GroupsEditPerms(w http.ResponseWriter, r *http.Request, user *c.User, sgid addPerm("UseConvosOnlyWithMod", g.Perms.UseConvosOnlyWithMod) addPerm("CreateProfileReply", g.Perms.CreateProfileReply) addPerm("AutoEmbed", g.Perms.AutoEmbed) + addPerm("AutoLink", g.Perms.AutoLink) var modPerms []c.NameLangToggle addPerm = func(permStr string, perm bool) { diff --git a/schema/mssql/inserts.sql b/schema/mssql/inserts.sql index a4091a64..c33626c6 100644 --- a/schema/mssql/inserts.sql +++ b/schema/mssql/inserts.sql @@ -7,9 +7,9 @@ INSERT INTO [settings] ([name],[content],[type]) VALUES ('rapid_loading','1','bo INSERT INTO [settings] ([name],[content],[type]) VALUES ('google_site_verify','','html-attribute'); INSERT INTO [themes] ([uname],[default]) VALUES ('cosora',1); INSERT INTO [emails] ([email],[uid],[validated]) VALUES ('admin@localhost',1,1); -INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditGroup":true,"EditGroupLocalPerms":true,"EditGroupGlobalPerms":true,"EditGroupSuperMod":true,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewAdminLogs":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,1,0,'Admin'); -INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserGroup":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,0,0,'Mod'); -INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Member','{"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"CreateReply":true}','{}',0,0,0,""); +INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditGroup":true,"EditGroupLocalPerms":true,"EditGroupGlobalPerms":true,"EditGroupSuperMod":true,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewAdminLogs":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,1,0,'Admin'); +INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserGroup":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,0,0,'Mod'); +INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Member','{"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"CreateReply":true}','{}',0,0,0,""); INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Banned','{"ViewTopic":true}','{}',0,0,1,""); INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Awaiting Activation','{"UseConvosOnlyWithMod":true,"ViewTopic":true}','{}',0,0,0,""); INSERT INTO [users_groups] ([name],[permissions],[plugin_perms],[is_mod],[is_admin],[is_banned],[tag]) VALUES ('Not Loggedin','{"ViewTopic":true}','{}',0,0,0,'Guest'); diff --git a/schema/mysql/inserts.sql b/schema/mysql/inserts.sql index a699fee1..5c56ac2f 100644 --- a/schema/mysql/inserts.sql +++ b/schema/mysql/inserts.sql @@ -15,9 +15,9 @@ INSERT INTO `settings`(`name`,`content`,`type`) VALUES ('rapid_loading','1','boo INSERT INTO `settings`(`name`,`content`,`type`) VALUES ('google_site_verify','','html-attribute'); INSERT INTO `themes`(`uname`,`default`) VALUES ('cosora',1); INSERT INTO `emails`(`email`,`uid`,`validated`) VALUES ('admin@localhost',1,1); -INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditGroup":true,"EditGroupLocalPerms":true,"EditGroupGlobalPerms":true,"EditGroupSuperMod":true,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewAdminLogs":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,1,0,'Admin'); -INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserGroup":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,0,0,'Mod'); -INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Member','{"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"CreateReply":true}','{}',0,0,0,""); +INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditGroup":true,"EditGroupLocalPerms":true,"EditGroupGlobalPerms":true,"EditGroupSuperMod":true,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewAdminLogs":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,1,0,'Admin'); +INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserGroup":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,0,0,'Mod'); +INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Member','{"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"CreateReply":true}','{}',0,0,0,""); INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Banned','{"ViewTopic":true}','{}',0,0,1,""); INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Awaiting Activation','{"UseConvosOnlyWithMod":true,"ViewTopic":true}','{}',0,0,0,""); INSERT INTO `users_groups`(`name`,`permissions`,`plugin_perms`,`is_mod`,`is_admin`,`is_banned`,`tag`) VALUES ('Not Loggedin','{"ViewTopic":true}','{}',0,0,0,'Guest'); diff --git a/schema/pgsql/inserts.sql b/schema/pgsql/inserts.sql index bd8a55a7..90ae683a 100644 --- a/schema/pgsql/inserts.sql +++ b/schema/pgsql/inserts.sql @@ -7,9 +7,9 @@ INSERT INTO "settings"("name","content","type") VALUES ('rapid_loading','1','boo INSERT INTO "settings"("name","content","type") VALUES ('google_site_verify','','html-attribute'); INSERT INTO "themes"("uname","default") VALUES ('cosora',1); INSERT INTO "emails"("email","uid","validated") VALUES ('admin@localhost',1,1); -INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditGroup":true,"EditGroupLocalPerms":true,"EditGroupGlobalPerms":true,"EditGroupSuperMod":true,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewAdminLogs":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,1,0,'Admin'); -INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserGroup":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,0,0,'Mod'); -INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Member','{"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"CreateReply":true}','{}',0,0,0,""); +INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditGroup":true,"EditGroupLocalPerms":true,"EditGroupGlobalPerms":true,"EditGroupSuperMod":true,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewAdminLogs":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,1,0,'Admin'); +INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserGroup":true,"ViewIPs":true,"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}','{}',1,0,0,'Mod'); +INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Member','{"UploadFiles":true,"UploadAvatars":true,"UseConvos":true,"UseConvosOnlyWithMod":true,"CreateProfileReply":true,"AutoEmbed":true,"AutoLink":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"CreateReply":true}','{}',0,0,0,""); INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Banned','{"ViewTopic":true}','{}',0,0,1,""); INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Awaiting Activation','{"UseConvosOnlyWithMod":true,"ViewTopic":true}','{}',0,0,0,""); INSERT INTO "users_groups"("name","permissions","plugin_perms","is_mod","is_admin","is_banned","tag") VALUES ('Not Loggedin','{"ViewTopic":true}','{}',0,0,0,'Guest');