com.marklogic.mgmt.api.security.User Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ml-app-deployer Show documentation
Show all versions of ml-app-deployer Show documentation
Java client for the MarkLogic REST Management API and for deploying applications to MarkLogic
/*
* Copyright (c) 2023 MarkLogic Corporation
*
* 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 com.marklogic.mgmt.api.security;
import com.marklogic.mgmt.api.API;
import com.marklogic.mgmt.api.Resource;
import com.marklogic.mgmt.resource.ResourceManager;
import com.marklogic.mgmt.resource.security.UserManager;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@XmlRootElement(name = "user-properties")
@XmlAccessorType(XmlAccessType.FIELD)
public class User extends Resource {
@XmlElement(name = "user-name")
private String userName;
private String description;
private String password;
@XmlElementWrapper(name = "external-names")
@XmlElement(name = "external-name")
private List externalName;
@XmlElementWrapper(name = "roles")
private List role;
@XmlElementWrapper(name = "permissions")
private List permission;
@XmlElementWrapper(name = "collections")
private List collection;
public User() {
super();
}
public User(API api, String userName) {
super(api);
this.userName = userName;
}
@Override
protected ResourceManager getResourceManager() {
return new UserManager(getClient());
}
@Override
protected String getResourceId() {
return userName;
}
public void addExternalName(String name) {
if (externalName == null) {
externalName = new ArrayList<>();
}
externalName.add(name);
}
public void addRole(String r) {
if (role == null) {
role = new ArrayList<>();
}
role.add(r);
}
public void addPermission(Permission p) {
if (permission == null) {
permission = new ArrayList<>();
}
permission.add(p);
}
public void addCollection(String c) {
if (collection == null) {
collection = new ArrayList<>();
}
collection.add(c);
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List getExternalName() {
return externalName;
}
public void setExternalName(List externalName) {
this.externalName = externalName;
}
public List getRole() {
return role;
}
public void setRole(List role) {
this.role = role;
}
public List getPermission() {
return permission;
}
public void setPermission(List permission) {
this.permission = permission;
}
public List getCollection() {
return collection;
}
public void setCollection(List collection) {
this.collection = collection;
}
}