diff --git a/casdoor/adapter.go b/casdoor/adapter.go index 74bdbc4..a6f3091 100644 --- a/casdoor/adapter.go +++ b/casdoor/adapter.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package casdoor import ( diff --git a/controllers/account.go b/controllers/account.go index 389b50d..3d2a8b8 100644 --- a/controllers/account.go +++ b/controllers/account.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package controllers import ( diff --git a/controllers/base.go b/controllers/base.go index 21bb0c8..667b2e5 100644 --- a/controllers/base.go +++ b/controllers/base.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package controllers import ( diff --git a/main.go b/main.go index 800d215..40db5e7 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/object/adapter.go b/object/adapter.go index ed375be..0599300 100644 --- a/object/adapter.go +++ b/object/adapter.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package object import ( diff --git a/storage/aliyun.go b/storage/aliyun.go index fa300c4..e462a41 100644 --- a/storage/aliyun.go +++ b/storage/aliyun.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage import ( diff --git a/util/array.go b/util/array.go index 4b5a676..c658ea9 100644 --- a/util/array.go +++ b/util/array.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package util import "fmt" diff --git a/util/color.go b/util/color.go index 8e9d5ab..d5bcaeb 100644 --- a/util/color.go +++ b/util/color.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package util import ( diff --git a/util/csv.go b/util/csv.go index 094d030..33eb94b 100644 --- a/util/csv.go +++ b/util/csv.go @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package util import ( diff --git a/util/header.go b/util/header.go new file mode 100644 index 0000000..c328d1e --- /dev/null +++ b/util/header.go @@ -0,0 +1,53 @@ +package util + +import ( + "fmt" + "os" + "path/filepath" + "strings" +) + +var licenseText = `// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +` + +func updateAllHeaders() { + err := filepath.Walk("../", func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if !info.IsDir() && (strings.HasSuffix(path, ".go") || strings.HasSuffix(path, ".js") && !strings.Contains(path, "node_modules")) { + data, err := os.ReadFile(path) + if err != nil { + return err + } + + if !strings.Contains(string(data), "Licensed under the Apache License") { + newData := licenseText + string(data) + err = os.WriteFile(path, []byte(newData), info.Mode()) + if err != nil { + return err + } + + fmt.Printf("Handled path: [%s]\n", path) + } + } + return nil + }) + if err != nil { + panic(err) + } +} diff --git a/util/header_test.go b/util/header_test.go new file mode 100644 index 0000000..843cf54 --- /dev/null +++ b/util/header_test.go @@ -0,0 +1,7 @@ +package util + +import "testing" + +func TestUpdateAllHeaders(t *testing.T) { + updateAllHeaders() +} diff --git a/web/craco.config.js b/web/craco.config.js index b873f56..2d1256a 100644 --- a/web/craco.config.js +++ b/web/craco.config.js @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + const CracoLessPlugin = require('craco-less'); module.exports = { diff --git a/web/src/App.js b/web/src/App.js index b6d85a0..742621a 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + import React, {Component} from "react"; import {Link, Redirect, Route, Switch, withRouter} from "react-router-dom"; import {Avatar, BackTop, Dropdown, Layout, Menu} from "antd"; diff --git a/web/src/App.test.js b/web/src/App.test.js index a2a61c9..534dfa9 100644 --- a/web/src/App.test.js +++ b/web/src/App.test.js @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + import React from "react"; import {render} from "@testing-library/react"; import App from "./App"; diff --git a/web/src/AuthCallback.js b/web/src/AuthCallback.js index d18c5d1..5811cd5 100644 --- a/web/src/AuthCallback.js +++ b/web/src/AuthCallback.js @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + import React from "react"; import {Button, Result, Spin} from "antd"; import {withRouter} from "react-router-dom"; diff --git a/web/src/ClusteringPage.js b/web/src/ClusteringPage.js index 502e210..865d5da 100644 --- a/web/src/ClusteringPage.js +++ b/web/src/ClusteringPage.js @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + import React from "react"; import * as Conf from "./Conf"; import * as WordsetBackend from "./backend/WordsetBackend"; diff --git a/web/src/Conf.js b/web/src/Conf.js index 23ae748..165eace 100644 --- a/web/src/Conf.js +++ b/web/src/Conf.js @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + export const AuthConfig = { // serverUrl: "https://door.casdoor.com", serverUrl: "http://localhost:7001", diff --git a/web/src/backend/AccountBackend.js b/web/src/backend/AccountBackend.js index 940cf7b..ba81c3c 100644 --- a/web/src/backend/AccountBackend.js +++ b/web/src/backend/AccountBackend.js @@ -1,3 +1,17 @@ +// Copyright 2023 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + import * as Setting from "../Setting"; export function getAccount() {