mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-27 14:32:55 -05:00
Merge pull request #8374 from owncloud/new_collaboration_service
feat: add new collaboration service (WOPI)
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
authmachine "github.com/owncloud/ocis/v2/services/auth-machine/pkg/config"
|
||||
authservice "github.com/owncloud/ocis/v2/services/auth-service/pkg/config"
|
||||
clientlog "github.com/owncloud/ocis/v2/services/clientlog/pkg/config"
|
||||
collaboration "github.com/owncloud/ocis/v2/services/collaboration/pkg/config"
|
||||
eventhistory "github.com/owncloud/ocis/v2/services/eventhistory/pkg/config"
|
||||
frontend "github.com/owncloud/ocis/v2/services/frontend/pkg/config"
|
||||
gateway "github.com/owncloud/ocis/v2/services/gateway/pkg/config"
|
||||
@@ -88,6 +89,7 @@ type Config struct {
|
||||
AuthMachine *authmachine.Config `yaml:"auth_machine"`
|
||||
AuthService *authservice.Config `yaml:"auth_service"`
|
||||
Clientlog *clientlog.Config `yaml:"clientlog"`
|
||||
Collaboration *collaboration.Config `yaml:"collaboration"`
|
||||
EventHistory *eventhistory.Config `yaml:"eventhistory"`
|
||||
Frontend *frontend.Config `yaml:"frontend"`
|
||||
Gateway *gateway.Config `yaml:"gateway"`
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
authmachine "github.com/owncloud/ocis/v2/services/auth-machine/pkg/config/defaults"
|
||||
authservice "github.com/owncloud/ocis/v2/services/auth-service/pkg/config/defaults"
|
||||
clientlog "github.com/owncloud/ocis/v2/services/clientlog/pkg/config/defaults"
|
||||
collaboration "github.com/owncloud/ocis/v2/services/collaboration/pkg/config/defaults"
|
||||
eventhistory "github.com/owncloud/ocis/v2/services/eventhistory/pkg/config/defaults"
|
||||
frontend "github.com/owncloud/ocis/v2/services/frontend/pkg/config/defaults"
|
||||
gateway "github.com/owncloud/ocis/v2/services/gateway/pkg/config/defaults"
|
||||
@@ -60,6 +61,7 @@ func DefaultConfig() *Config {
|
||||
AuthMachine: authmachine.DefaultConfig(),
|
||||
AuthService: authservice.DefaultConfig(),
|
||||
Clientlog: clientlog.DefaultConfig(),
|
||||
Collaboration: collaboration.DefaultConfig(),
|
||||
EventHistory: eventhistory.DefaultConfig(),
|
||||
Frontend: frontend.DefaultConfig(),
|
||||
Gateway: gateway.DefaultConfig(),
|
||||
|
||||
@@ -5,8 +5,36 @@ import (
|
||||
"math/big"
|
||||
)
|
||||
|
||||
const (
|
||||
// PasswordChars contains alphanumeric chars (0-9, A-Z, a-z), plus "-=+!@#$%^&*."
|
||||
PasswordChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-=+!@#$%^&*."
|
||||
// AlphaNumChars contains alphanumeric chars (0-9, A-Z, a-z)
|
||||
AlphaNumChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
)
|
||||
|
||||
// GenerateRandomPassword generates a random password with the given length.
|
||||
// The password will contain chars picked from the `PasswordChars` constant.
|
||||
// If an error happens, the string will be empty and the error will be non-nil.
|
||||
//
|
||||
// This is equivalent to `GenerateRandomString(PasswordChars, length)`
|
||||
func GenerateRandomPassword(length int) (string, error) {
|
||||
const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-=+!@#$%^&*."
|
||||
return generateString(PasswordChars, length)
|
||||
}
|
||||
|
||||
// GenerateRandomString generates a random string with the given length
|
||||
// based on the chars provided. You can use `PasswordChars` or `AlphaNumChars`
|
||||
// constants, or even any other string.
|
||||
//
|
||||
// Chars from the provided string will be picked uniformly. The provided
|
||||
// constants have unique chars, which means that all the chars will have the
|
||||
// same probability of being picked.
|
||||
// You can use your own strings to change that probability. For example, using
|
||||
// "AAAB" you'll have a 75% of probability of getting "A" and 25% of "B"
|
||||
func GenerateRandomString(chars string, length int) (string, error) {
|
||||
return generateString(chars, length)
|
||||
}
|
||||
|
||||
func generateString(chars string, length int) (string, error) {
|
||||
ret := make([]byte, length)
|
||||
for i := 0; i < length; i++ {
|
||||
num, err := rand.Int(rand.Reader, big.NewInt(int64(len(chars))))
|
||||
|
||||
Reference in New Issue
Block a user