blogRight in UserDB.

Look at the Fileshare, for how to use it.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1722 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 19 years ago
parent 2ee5796e76
commit af1da090bb

@ -63,6 +63,7 @@ Current User: #[username]#
<input type="checkbox" name="adminRight" #(adminRight)#::checked#(/adminRight)#>Admin<br /> <input type="checkbox" name="adminRight" #(adminRight)#::checked#(/adminRight)#>Admin<br />
<input type="checkbox" name="uploadRight" #(uploadRight)#::checked#(/uploadRight)#>Fileshare-Upload<br /> <input type="checkbox" name="uploadRight" #(uploadRight)#::checked#(/uploadRight)#>Fileshare-Upload<br />
<input type="checkbox" name="downloadRight" #(downloadRight)#::checked#(/downloadRight)#>Fileshare-Download<br /> <input type="checkbox" name="downloadRight" #(downloadRight)#::checked#(/downloadRight)#>Fileshare-Download<br />
<input type="checkbox" name="blogRight" #(blogRight)#::checked#(/blogRight)#>Blog<br />
</td> </td>
</tr> </tr>
<tr> <tr>

@ -107,6 +107,7 @@ public class User_p {
prop.put("page_uploadRight", (entry.hasUploadRight()?1:0)); prop.put("page_uploadRight", (entry.hasUploadRight()?1:0));
prop.put("page_downloadRight", (entry.hasDownloadRight()?1:0)); prop.put("page_downloadRight", (entry.hasDownloadRight()?1:0));
prop.put("page_adminRight", (entry.hasAdminRight()?1:0)); prop.put("page_adminRight", (entry.hasAdminRight()?1:0));
prop.put("page_blogRight", (entry.hasBlogRight()?1:0));
}else if( post.containsKey("delete_user") && !((String)post.get("user")).equals("newuser") ){ }else if( post.containsKey("delete_user") && !((String)post.get("user")).equals("newuser") ){
sb.userDB.removeEntry((String)post.get("user")); sb.userDB.removeEntry((String)post.get("user"));
} }
@ -132,6 +133,7 @@ public class User_p {
String uploadRight=( post.containsKey("uploadRight")&&((String)post.get("uploadRight")).equals("on") ? "true" : "false"); String uploadRight=( post.containsKey("uploadRight")&&((String)post.get("uploadRight")).equals("on") ? "true" : "false");
String downloadRight=( post.containsKey("downloadRight")&&((String)post.get("downloadRight")).equals("on") ? "true" : "false"); String downloadRight=( post.containsKey("downloadRight")&&((String)post.get("downloadRight")).equals("on") ? "true" : "false");
String adminRight=( post.containsKey("adminRight")&&((String)post.get("adminRight")).equals("on") ? "true" : "false"); String adminRight=( post.containsKey("adminRight")&&((String)post.get("adminRight")).equals("on") ? "true" : "false");
String blogRight=( post.containsKey("blogRight")&&((String)post.get("blogRight")).equals("on") ? "true" : "false");
HashMap mem=new HashMap(); HashMap mem=new HashMap();
if( post.get("current_user").equals("newuser")){ //new user if( post.get("current_user").equals("newuser")){ //new user
@ -146,7 +148,7 @@ public class User_p {
mem.put(userDB.Entry.PROXY_RIGHT, proxyRight); mem.put(userDB.Entry.PROXY_RIGHT, proxyRight);
mem.put(userDB.Entry.UPLOAD_RIGHT, uploadRight); mem.put(userDB.Entry.UPLOAD_RIGHT, uploadRight);
mem.put(userDB.Entry.DOWNLOAD_RIGHT, downloadRight); mem.put(userDB.Entry.DOWNLOAD_RIGHT, downloadRight);
mem.put(userDB.Entry.ADMIN_RIGHT, adminRight); mem.put(userDB.Entry.BLOG_RIGHT, blogRight);
entry=sb.userDB.createEntry(username, mem); entry=sb.userDB.createEntry(username, mem);
sb.userDB.addEntry(entry); sb.userDB.addEntry(entry);
@ -170,6 +172,7 @@ public class User_p {
entry.setProperty(userDB.Entry.UPLOAD_RIGHT, uploadRight); entry.setProperty(userDB.Entry.UPLOAD_RIGHT, uploadRight);
entry.setProperty(userDB.Entry.DOWNLOAD_RIGHT, downloadRight); entry.setProperty(userDB.Entry.DOWNLOAD_RIGHT, downloadRight);
entry.setProperty(userDB.Entry.ADMIN_RIGHT, adminRight); entry.setProperty(userDB.Entry.ADMIN_RIGHT, adminRight);
entry.setProperty(userDB.Entry.BLOG_RIGHT, blogRight);
}catch (IOException e){ }catch (IOException e){
} }
}else{ }else{

@ -264,6 +264,7 @@ public final class userDB {
public static final String DOWNLOAD_RIGHT = "downloadRight"; public static final String DOWNLOAD_RIGHT = "downloadRight";
public static final String ADMIN_RIGHT = "adminRight"; public static final String ADMIN_RIGHT = "adminRight";
public static final String PROXY_RIGHT = "proxyRight"; public static final String PROXY_RIGHT = "proxyRight";
public static final String BLOG_RIGHT = "blogRight";
// this is a simple record structure that hold all properties of a user // this is a simple record structure that hold all properties of a user
private Map mem; private Map mem;
@ -445,6 +446,9 @@ public final class userDB {
public boolean hasAdminRight() { public boolean hasAdminRight() {
return (this.mem.containsKey(ADMIN_RIGHT)?((String)this.mem.get(ADMIN_RIGHT)).equals("true"):false); return (this.mem.containsKey(ADMIN_RIGHT)?((String)this.mem.get(ADMIN_RIGHT)).equals("true"):false);
} }
public boolean hasBlogRight() {
return (this.mem.containsKey(BLOG_RIGHT)?((String)this.mem.get(BLOG_RIGHT)).equals("true"):false);
}
public boolean isLoggedOut(){ public boolean isLoggedOut(){
return (this.mem.containsKey(LOGGED_OUT)?((String)this.mem.get(LOGGED_OUT)).equals("true"):false); return (this.mem.containsKey(LOGGED_OUT)?((String)this.mem.get(LOGGED_OUT)).equals("true"):false);
} }

Loading…
Cancel
Save