mirror of
https://github.com/documize/community.git
synced 2025-07-20 05:39:42 +02:00
Create default users groups during setup process
This commit is contained in:
parent
e6e099db1a
commit
f3e4b4060e
3 changed files with 694 additions and 655 deletions
|
@ -165,7 +165,6 @@ func setupAccount(rt *env.Runtime, completion onboardRequest, serial string) (er
|
||||||
labelID := uniqueid.Generate()
|
labelID := uniqueid.Generate()
|
||||||
sql = fmt.Sprintf("insert into label (refid, orgid, label, type, userid) values (\"%s\", \"%s\", \"My Project\", 2, \"%s\")", labelID, orgID, userID)
|
sql = fmt.Sprintf("insert into label (refid, orgid, label, type, userid) values (\"%s\", \"%s\", \"My Project\", 2, \"%s\")", labelID, orgID, userID)
|
||||||
_, err = runSQL(rt, sql)
|
_, err = runSQL(rt, sql)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rt.Log.Error("insert into label failed", err)
|
rt.Log.Error("insert into label failed", err)
|
||||||
}
|
}
|
||||||
|
@ -180,6 +179,45 @@ func setupAccount(rt *env.Runtime, completion onboardRequest, serial string) (er
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create some user groups
|
||||||
|
groupDevID := uniqueid.Generate()
|
||||||
|
sql = fmt.Sprintf("INSERT INTO role (refid, orgid, role, purpose) VALUES (\"%s\", \"%s\", \"Technology\", \"On-site and remote development teams\")", groupDevID, orgID)
|
||||||
|
_, err = runSQL(rt, sql)
|
||||||
|
if err != nil {
|
||||||
|
rt.Log.Error("insert into role failed", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
groupProjectID := uniqueid.Generate()
|
||||||
|
sql = fmt.Sprintf("INSERT INTO role (refid, orgid, role, purpose) VALUES (\"%s\", \"%s\", \"Project Management\", \"HQ project management\")", groupProjectID, orgID)
|
||||||
|
_, err = runSQL(rt, sql)
|
||||||
|
if err != nil {
|
||||||
|
rt.Log.Error("insert into role failed", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
groupBackofficeID := uniqueid.Generate()
|
||||||
|
sql = fmt.Sprintf("INSERT INTO role (refid, orgid, role, purpose) VALUES (\"%s\", \"%s\", \"Back Office\", \"Non-IT and PMO personnel\")", groupBackofficeID, orgID)
|
||||||
|
_, err = runSQL(rt, sql)
|
||||||
|
if err != nil {
|
||||||
|
rt.Log.Error("insert into role failed", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Join some groups
|
||||||
|
sql = fmt.Sprintf("INSERT INTO rolemember (orgid, roleid, userid) VALUES (\"%s\", \"%s\", \"%s\")", orgID, groupDevID, userID)
|
||||||
|
_, err = runSQL(rt, sql)
|
||||||
|
if err != nil {
|
||||||
|
rt.Log.Error("insert into rolemember failed", err)
|
||||||
|
}
|
||||||
|
sql = fmt.Sprintf("INSERT INTO rolemember (orgid, roleid, userid) VALUES (\"%s\", \"%s\", \"%s\")", orgID, groupProjectID, userID)
|
||||||
|
_, err = runSQL(rt, sql)
|
||||||
|
if err != nil {
|
||||||
|
rt.Log.Error("insert into rolemember failed", err)
|
||||||
|
}
|
||||||
|
sql = fmt.Sprintf("INSERT INTO rolemember (orgid, roleid, userid) VALUES (\"%s\", \"%s\", \"%s\")", orgID, groupBackofficeID, userID)
|
||||||
|
_, err = runSQL(rt, sql)
|
||||||
|
if err != nil {
|
||||||
|
rt.Log.Error("insert into rolemember failed", err)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,8 @@ export default Route.extend({
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
let pwd = document.head.querySelector("[property=dbhash]").content;
|
let pwd = document.head.querySelector("[property=dbhash]").content;
|
||||||
if (pwd.length === 0 || pwd === "{{.DBhash}}") {
|
if (pwd.length === 0 || pwd === "{{.DBhash}}") {
|
||||||
this.transitionTo('auth.login'); // don't allow access to this page if we are not in setup mode, kick them out altogether
|
// don't allow access to this page if we are not in setup mode
|
||||||
|
this.transitionTo('auth.login');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue