Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add other APIs and testing #72

Merged
merged 11 commits into from
Oct 22, 2023
22 changes: 22 additions & 0 deletions src/main/java/org/casbin/casdoor/entity/AccountItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2023 The Casdoor 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 org.casbin.casdoor.entity;
hsluoyz marked this conversation as resolved.
Show resolved Hide resolved

public class AccountItem {

Check warning on line 17 in src/main/java/org/casbin/casdoor/entity/AccountItem.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/AccountItem.java#L17

Added line #L17 was not covered by tests
public String name;
public boolean visible;
public String viewRule;
public String modifyRule;
}
43 changes: 43 additions & 0 deletions src/main/java/org/casbin/casdoor/entity/Adapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2023 The Casdoor 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 org.casbin.casdoor.entity;

public class Adapter {
public String owner;
public String name;
public String createdTime;
public String type;
public String databaseType;
public String host;
public int port;
public String user;
public String password;
public String database;
public String table;
public String tableNamePrefix;
public boolean isEnabled;


public Adapter() {
}

Check warning on line 34 in src/main/java/org/casbin/casdoor/entity/Adapter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Adapter.java#L33-L34

Added lines #L33 - L34 were not covered by tests

public Adapter(String owner, String name, String createdTime, String user, String host) {
this.owner = owner;
this.name = name;
this.createdTime = createdTime;
this.host = host;
this.user = user;
}

Check warning on line 42 in src/main/java/org/casbin/casdoor/entity/Adapter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Adapter.java#L36-L42

Added lines #L36 - L42 were not covered by tests
}
20 changes: 20 additions & 0 deletions src/main/java/org/casbin/casdoor/entity/MfaItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2023 The Casdoor 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 org.casbin.casdoor.entity;
hsluoyz marked this conversation as resolved.
Show resolved Hide resolved

public class MfaItem {

Check warning on line 17 in src/main/java/org/casbin/casdoor/entity/MfaItem.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/MfaItem.java#L17

Added line #L17 was not covered by tests
public String name;
public String rule;
}
34 changes: 26 additions & 8 deletions src/main/java/org/casbin/casdoor/entity/Organization.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,39 @@
public String createdTime;
public String displayName;
public String websiteUrl;
public String favicon;
public String passwordType;
public String passwordSalt;
public String[] passwordOptions;
public String[] countryCodes;
public String defaultAvatar;
public String defaultApplication;
public String[] tags;
public String[] languages;
public ThemeData themeData;
public String masterPassword;
public int initScore;
public boolean enableSoftDeletion;
public boolean isProfilePublic;
public MfaItem[] mfaItems;
public AccountItem[] accountItems;

public Organization() {
}

public Organization(String owner, String name, String createdTime, String displayName, String websiteUrl, String passwordType) {
public Organization(String owner, String name, String createdTime, String displayName, String websiteUrl, String passwordType, String[] passwordOptions, String[] countryCodes, String[] tags, String[] languages, int initScore, boolean enableSoftDeletion, boolean isProfilePublic) {

Check warning on line 40 in src/main/java/org/casbin/casdoor/entity/Organization.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Organization.java#L40

Added line #L40 was not covered by tests
this.owner = owner;
this.name = name;
this.createdTime = createdTime;
this.displayName = displayName;
this.websiteUrl = websiteUrl;
this.passwordType = passwordType;
this.passwordOptions = passwordOptions;
this.countryCodes = countryCodes;
this.tags = tags;
this.languages = languages;
this.initScore = initScore;
this.enableSoftDeletion = enableSoftDeletion;
this.isProfilePublic = isProfilePublic;

Check warning on line 53 in src/main/java/org/casbin/casdoor/entity/Organization.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Organization.java#L47-L53

Added lines #L47 - L53 were not covered by tests
}

public String favicon;
public String passwordType;
public String passwordSalt;
public String phonePrefix;
public Organization() {
}

Check warning on line 57 in src/main/java/org/casbin/casdoor/entity/Organization.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Organization.java#L56-L57

Added lines #L56 - L57 were not covered by tests
}
42 changes: 42 additions & 0 deletions src/main/java/org/casbin/casdoor/entity/Plan.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2023 The Casdoor 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 org.casbin.casdoor.entity;

import java.util.List;

public class Plan {
public String owner;
public String name;
public String createdTime;
public String displayName;
public String description;
public double pricePerMonth;
public double pricePerYear;
public String currency;
public boolean isEnabled;
public String role;
public List<String> options;

public Plan(String owner, String name, String createdTime, String displayName, String description) {
this.owner = owner;
this.name = name;
this.createdTime = createdTime;
this.displayName = displayName;
this.description = description;
}

Check warning on line 38 in src/main/java/org/casbin/casdoor/entity/Plan.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Plan.java#L32-L38

Added lines #L32 - L38 were not covered by tests

public Plan() {
}

Check warning on line 41 in src/main/java/org/casbin/casdoor/entity/Plan.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Plan.java#L40-L41

Added lines #L40 - L41 were not covered by tests
}
65 changes: 65 additions & 0 deletions src/main/java/org/casbin/casdoor/entity/Pricing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2023 The Casdoor 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 CasdoorPermissions and
// limitations under the License.

package org.casbin.casdoor.entity;

import java.util.List;

public class Pricing {
public String owner;

public String name;

public String createdTime;

public String displayName;

public String description;

public List<String> plans;

public boolean isEnabled;

public int trialDuration;

public String application;

public String submitter;

public String approver;

public String approveTime;

public String state;

public Pricing() {

Check warning on line 46 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L46

Added line #L46 was not covered by tests

}

Check warning on line 48 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L48

Added line #L48 was not covered by tests

public Pricing(String owner, String name, String createdTime, String displayName, String application, String description) {

Check warning on line 50 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L50

Added line #L50 was not covered by tests

this.owner = owner;

Check warning on line 52 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L52

Added line #L52 was not covered by tests

this.name = name;

Check warning on line 54 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L54

Added line #L54 was not covered by tests

this.createdTime = createdTime;

Check warning on line 56 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L56

Added line #L56 was not covered by tests

this.displayName = displayName;

Check warning on line 58 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L58

Added line #L58 was not covered by tests

this.description = description;

Check warning on line 60 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L60

Added line #L60 was not covered by tests

this.application = application;

Check warning on line 62 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L62

Added line #L62 was not covered by tests

}

Check warning on line 64 in src/main/java/org/casbin/casdoor/entity/Pricing.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Pricing.java#L64

Added line #L64 was not covered by tests
}
52 changes: 52 additions & 0 deletions src/main/java/org/casbin/casdoor/entity/Product.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2023 The Casdoor 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 CasdoorPermissions and
// limitations under the License.

package org.casbin.casdoor.entity;

import java.util.List;

public class Product {
public String owner;
public String name;
public String createdTime;
public String displayName;
public String image;
public String detail;
public String description;
public String tag;
public String currency;
public double price;
public int quantity;
public int sold;
public List<String> providers;
public String returnUrl;
public String state;
public List<Provier> providerObjs;

public Product() {
}

Check warning on line 38 in src/main/java/org/casbin/casdoor/entity/Product.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Product.java#L37-L38

Added lines #L37 - L38 were not covered by tests

public Product(String owner, String name, String createdTime, String displayName, String image, String description, String tag, int quantity, int sold, String state) {
this.owner = owner;
this.name = name;
this.createdTime = createdTime;
this.displayName = displayName;
this.image = image;
this.description = description;
this.tag = tag;
this.quantity = quantity;
this.sold = sold;
this.state = state;
}

Check warning on line 51 in src/main/java/org/casbin/casdoor/entity/Product.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Product.java#L40-L51

Added lines #L40 - L51 were not covered by tests
}
22 changes: 9 additions & 13 deletions src/main/java/org/casbin/casdoor/entity/Resource.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package org.casbin.casdoor.entity;



import java.io.Serializable;

/**
Expand All @@ -24,17 +23,14 @@
*/

public class Resource implements Serializable {
public String owner;
public String name;

public Resource() {
}

public Resource(String owner, String name) {
this.owner = owner;
this.name = name;
}

}
public String owner;
public String name;

public Resource() {
}

Check warning on line 30 in src/main/java/org/casbin/casdoor/entity/Resource.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Resource.java#L29-L30

Added lines #L29 - L30 were not covered by tests

public Resource(String owner, String name) {
this.owner = owner;
this.name = name;
}

Check warning on line 35 in src/main/java/org/casbin/casdoor/entity/Resource.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Resource.java#L32-L35

Added lines #L32 - L35 were not covered by tests
}
5 changes: 4 additions & 1 deletion src/main/java/org/casbin/casdoor/entity/Role.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@
@JsonProperty("isEnabled")
public boolean isEnabled;

public String description;

public Role() {
}

public Role(String owner, String name, String createdTime, String displayName) {
public Role(String owner, String name, String createdTime, String displayName,String description) {

Check warning on line 41 in src/main/java/org/casbin/casdoor/entity/Role.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Role.java#L41

Added line #L41 was not covered by tests
this.owner = owner;
this.name = name;
this.createdTime = createdTime;
this.displayName = displayName;
this.description = description;

Check warning on line 46 in src/main/java/org/casbin/casdoor/entity/Role.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/casbin/casdoor/entity/Role.java#L46

Added line #L46 was not covered by tests
}
}
Loading
Loading