Skip to content

Commit

Permalink
feat: Add other APIs and testing (#72)
Browse files Browse the repository at this point in the history
* add:ApplicationTest.java add test cases for user、application objects and user、application operations

* fix:update ApplicationTest and add TestDefaultConfig

* fix: add test case for application
Slimmed down the files starting with Casdoor, removed the corresponding toString method, and changed the permission modifier to public.

* feat: add test cases for all objects and all opertions
feat: Add test for all object

* fix: add test for enforcer、group、model、payment
Added entity classes and service methods for enforcer, group, model, and payment and wrote corresponding test methods to test them.

* fix: Adding additional test methods
Added methods for adding, deleting and retrieving other test objects

* fix: add Apache license header and Modify public fields
  • Loading branch information
WindyDante authored Oct 22, 2023
1 parent 15052b6 commit 8bc9350
Show file tree
Hide file tree
Showing 63 changed files with 2,178 additions and 117 deletions.
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;

public class AccountItem {
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() {
}

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;
}
}
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;

public class MfaItem {
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 class Organization {
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) {
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;
}

public String favicon;
public String passwordType;
public String passwordSalt;
public String phonePrefix;
public Organization() {
}
}
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;
}

public Plan() {
}
}
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() {

}

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

this.owner = owner;

this.name = name;

this.createdTime = createdTime;

this.displayName = displayName;

this.description = description;

this.application = application;

}
}
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() {
}

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;
}
}
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() {
}

public Resource(String owner, String name) {
this.owner = owner;
this.name = name;
}
}
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 @@ public class Role implements Serializable {
@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) {
this.owner = owner;
this.name = name;
this.createdTime = createdTime;
this.displayName = displayName;
this.description = description;
}
}
Loading

0 comments on commit 8bc9350

Please sign in to comment.