-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(orgs): split creation flows + add new kind of roles based organi…
…zation (#1429) Co-authored-by: n0izn0iz <[email protected]>
- Loading branch information
1 parent
5529005
commit b843b86
Showing
46 changed files
with
2,373 additions
and
803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
cypress/e2e/gno/upp-form.cy.ts → cypress/e2e/gno/upp/upp-form.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module gno.land/p/teritori/dao_roles_group | ||
|
||
require ( | ||
gno.land/p/demo/json v0.0.0-latest | ||
gno.land/p/teritori/dao_interfaces v0.0.0-latest | ||
gno.land/p/teritori/jsonutil v0.0.0-latest | ||
gno.land/p/teritori/role_manager v0.0.0-latest | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package dao_roles_group | ||
|
||
import ( | ||
"std" | ||
|
||
"gno.land/p/demo/json" | ||
dao_interfaces "gno.land/p/teritori/dao_interfaces" | ||
"gno.land/p/teritori/jsonutil" | ||
"gno.land/p/teritori/role_manager" | ||
) | ||
|
||
type RolesGroup struct { | ||
dao_interfaces.IRolesModule | ||
|
||
rm *role_manager.RoleManager | ||
} | ||
|
||
func NewRolesGroup() *RolesGroup { | ||
return &RolesGroup{ | ||
rm: role_manager.NewWithAddress(std.PrevRealm().Addr()), | ||
} | ||
} | ||
|
||
func (r *RolesGroup) Info() dao_interfaces.ModuleInfo { | ||
return dao_interfaces.ModuleInfo{ | ||
Kind: "gno/p/teritori/dao_roles_group", | ||
Version: "0.1.0", | ||
} | ||
} | ||
|
||
func (r *RolesGroup) ConfigJSON() string { | ||
return json.ObjectNode("", map[string]*json.Node{ | ||
"totalRoles": jsonutil.IntNode(r.rm.CountRoles()), | ||
}).String() | ||
} | ||
|
||
func (r *RolesGroup) Render(path string) string { | ||
return "Not implemented yet" | ||
} | ||
|
||
func (r *RolesGroup) HasRole(address std.Address, role string) bool { | ||
return r.rm.HasRole(address, role) | ||
} | ||
|
||
func (r *RolesGroup) NewRole(roleName string) { | ||
r.rm.CreateNewRole(roleName, []string{}) | ||
} | ||
|
||
func (r *RolesGroup) DeleteRole(roleName string) { | ||
r.rm.DeleteRole(roleName) | ||
} | ||
|
||
func (r *RolesGroup) GrantRole(address std.Address, role string) { | ||
r.rm.AddRoleToUser(address, role) | ||
} | ||
|
||
func (r *RolesGroup) RevokeRole(address std.Address, role string) { | ||
r.rm.RemoveRoleFromUser(address, role) | ||
} | ||
|
||
func (r *RolesGroup) GetMemberRoles(address std.Address) []string { | ||
return r.rm.GetUserRoles(address) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.