GetRole returns the role with the given name. Use RoleExists to determine if the role exists, as this will return a role with the default values set if it does not exist.
(name string)
| 72 | // GetRole returns the role with the given name. Use RoleExists to determine if the role exists, as this will return a |
| 73 | // role with the default values set if it does not exist. |
| 74 | func GetRole(name string) Role { |
| 75 | roleID, ok := globalDatabase.rolesByName[name] |
| 76 | if !ok { |
| 77 | return createDefaultRoleWithoutID(name) |
| 78 | } |
| 79 | return globalDatabase.rolesByID[roleID] |
| 80 | } |
| 81 | |
| 82 | // RenameRole renames the role with the old name to the new name. If the role does not exist, then this is a no-op. |
| 83 | func RenameRole(oldName string, newName string) { |
no test coverage detected