This commit is contained in:
stom79 2019-01-29 11:34:37 +01:00
parent 2f9abc4873
commit 2a1526d42b
2 changed files with 115 additions and 0 deletions

View File

@ -2279,8 +2279,24 @@ public class API {
return apiResponse;
}
//Pleroma admin calls
/**
* Retrieves Accounts when searching (ie: via @...) *synchronously*
* @return boolean
*/
public boolean isPleromaAdmin(String nickname) {
try {
HttpsConnection httpsConnection = new HttpsConnection(context);
String response = httpsConnection.get(String.format(Helper.getLiveInstanceWithProtocol(context)+"/api/pleroma/admin/permission_group/%s/admin",nickname), 60, null, prefKeyOauthTokenT);
//Call didn't return a 404, so the account is admin
return true;
} catch (Exception e) {
return false;
}
}
/**
* Retrieves Pleroma emoji *synchronously*
*
* @return APIResponse
*/

View File

@ -0,0 +1,99 @@
/* Copyright 2017 Thomas Schneider
*
* This file is a part of Mastalab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.client.Entities;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by Thomas on 27/01/2019.
* Manage Entity PleromaAdmin
*/
public class PleromaAdmin implements Parcelable {
private String nickname;
private String email;
private String password;
private String tags;
public PleromaAdmin(){}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.nickname);
dest.writeString(this.email);
dest.writeString(this.password);
dest.writeString(this.tags);
}
protected PleromaAdmin(Parcel in) {
this.nickname = in.readString();
this.email = in.readString();
this.password = in.readString();
this.tags = in.readString();
}
public static final Creator<PleromaAdmin> CREATOR = new Creator<PleromaAdmin>() {
@Override
public PleromaAdmin createFromParcel(Parcel source) {
return new PleromaAdmin(source);
}
@Override
public PleromaAdmin[] newArray(int size) {
return new PleromaAdmin[size];
}
};
}