mirror of
https://github.com/OpenBankProject/API-Explorer.git
synced 2026-02-06 18:56:49 +00:00
Merge branch 'develop' of https://github.com/OpenBankProject/Social-Finance into develop
This commit is contained in:
commit
34bb31b6ca
10
pom.xml
10
pom.xml
@ -118,11 +118,11 @@
|
||||
<version>${scala.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-library</artifactId>
|
||||
<version>${scala.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-library</artifactId>
|
||||
<version>${scala.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>oauth.signpost</groupId>
|
||||
<artifactId>signpost-commonshttp4</artifactId>
|
||||
|
||||
@ -129,6 +129,18 @@ object ObpAPI extends Loggable {
|
||||
ObpGet("/v1.2.1/banks/" + bankId + "/accounts/" + accountId + "/permissions").flatMap(x => x.extractOpt[PermissionsJson])
|
||||
}
|
||||
|
||||
def removePermission(bankId: String, accountId: String, userId : String, viewId: String) = {
|
||||
val removePermissionUrl = "/v1.2.1/banks/" + urlEncode(bankId) + "/accounts/" + urlEncode(accountId) + "/permissions/" +
|
||||
urlEncode(defaultProvider) + "/" + urlEncode(userId) + "/views/" + urlEncode(viewId)
|
||||
ObpDelete(removePermissionUrl)
|
||||
}
|
||||
|
||||
def removeAllPermissions(bankId: String, accountId: String, userId: String) = {
|
||||
val removeAllPermissionsUrl = "/v1.2.1/banks/" + urlEncode(bankId) + "/accounts/" + urlEncode(accountId) + "/permissions/" +
|
||||
urlEncode(defaultProvider) + "/" + urlEncode(userId) + "/views"
|
||||
ObpDelete(removeAllPermissionsUrl)
|
||||
}
|
||||
|
||||
def getViews(bankId: String, accountId: String) : Box[List[ViewJson]] = {
|
||||
for {
|
||||
json <- ObpGet("/v1.2.1/banks/" + bankId + "/accounts/" + accountId + "/views")
|
||||
@ -141,7 +153,7 @@ object ObpAPI extends Loggable {
|
||||
json <- ObpGet("/v1.2.1/banks/" + bankId + "/accounts/" + accountId + "/views")
|
||||
} yield {
|
||||
json \ "views" match {
|
||||
case JArray(l) => l.map(viewJson =>
|
||||
case JArray(l) => l.map(viewJson =>
|
||||
viewJson.values match{
|
||||
case vals: Map[String, Any] => CompleteViewJson(vals)
|
||||
case _ => CompleteViewJson(Map.empty)
|
||||
@ -150,19 +162,29 @@ object ObpAPI extends Loggable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def removePermission(bankId: String, accountId: String, userId : String, viewId: String) = {
|
||||
val removePermissionUrl = "/v1.2.1/banks/" + urlEncode(bankId) + "/accounts/" + urlEncode(accountId) + "/permissions/" +
|
||||
urlEncode(defaultProvider) + "/" + urlEncode(userId) + "/views/" + urlEncode(viewId)
|
||||
ObpDelete(removePermissionUrl)
|
||||
|
||||
def addView(bankId: String, accountId: String, userId : String, viewName: String) = {
|
||||
val addViewUrl = "/v1.2.1/banks/" + urlEncode(bankId) + "/accounts/" + urlEncode(accountId) +
|
||||
"/views/"
|
||||
|
||||
/*
|
||||
{
|
||||
"name": "the view name",
|
||||
"description": "a little description.",
|
||||
"is_public": "Boolean to specify if the view can be accessible to not logged in users",
|
||||
"which_alias_to_use": "public/private/none",
|
||||
"hide_metadata_if_alias_used" : true/false,
|
||||
"allowed_actions": [
|
||||
"can_see_transaction_this_bank_account",
|
||||
"can_see_transaction_label",
|
||||
"can_see_transaction_other_bank_account"
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
//ObpPost(addViewUrl, new JObject())
|
||||
}
|
||||
|
||||
def removeAllPermissions(bankId: String, accountId: String, userId: String) = {
|
||||
val removeAllPermissionsUrl = "/v1.2.1/banks/" + urlEncode(bankId) + "/accounts/" + urlEncode(accountId) + "/permissions/" +
|
||||
urlEncode(defaultProvider) + "/" + urlEncode(userId) + "/views"
|
||||
ObpDelete(removeAllPermissionsUrl)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return The jsons for the tags that were were successfully added
|
||||
*/
|
||||
|
||||
@ -1,16 +1,19 @@
|
||||
package code.snippet
|
||||
|
||||
import net.liftweb.http.js.JsCmd
|
||||
import net.liftweb.util.Helpers._
|
||||
import scala.xml.NodeSeq
|
||||
import code.lib.ObpJson.CompleteViewJson
|
||||
import net.liftweb.util.CssSel
|
||||
import net.liftweb.http.SHtml
|
||||
import net.liftweb.http.{S, SHtml}
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
import net.liftweb.json._
|
||||
import net.liftweb.http.js.JsCmds.Alert
|
||||
import net.liftweb.common.Box
|
||||
import net.liftweb.http.js.JsCmds.{SetHtml, Alert}
|
||||
import net.liftweb.common.{Loggable, Box}
|
||||
import code.lib.ObpAPI
|
||||
import net.liftweb.http.S
|
||||
import net.liftweb.http.SHtml.{text,ajaxSubmit}
|
||||
import _root_.scala.xml.Text
|
||||
import ObpAPI.addView
|
||||
|
||||
case class ViewUpdateData(
|
||||
viewId: String,
|
||||
@ -69,15 +72,15 @@ class ViewsOverview(viewsDataJson: ViewsDataJSON) {
|
||||
}
|
||||
|
||||
val ids = getIds()
|
||||
val viewNameSel = ".view_name *" #> views.map( view => view.shortName.getOrElse(""))
|
||||
val shortNamesSel = ".short_name" #> views.map( view => "* *" #> view.shortName.getOrElse("") & "* [data-viewid]" #> view.id )
|
||||
val aliasSel = ".alias" #> views.map( view => "* *" #> aliasType(view.alias) & "* [data-viewid]" #> view.id )
|
||||
val descriptionSel = ".description" #> views.map( view => ".desc *" #> view.description.getOrElse("") & "* [data-viewid]" #> view.id )
|
||||
val isPublicSel = ".is_public *" #> getIfIsPublic()
|
||||
val addDeleteSel = ".delete" #> ids.map(x => "* [data-id]" #> x)
|
||||
val addEditSel = ".edit" #> ids.map(x => "* [data-id]" #> x)
|
||||
val addSaveSel = ".save" #> ids.map(x => ("* [data-id]" #> x) & saveOnClick(x))
|
||||
val addCancelSel = ".cancel" #> ids.map(x => "* [data-id]" #> x)
|
||||
val viewNameSel = ".view_name *" #> views.map( view => view.shortName.getOrElse(""))
|
||||
val shortNamesSel = ".short_name" #> views.map( view => "* *" #> view.shortName.getOrElse("") & "* [data-viewid]" #> view.id )
|
||||
val aliasSel = ".alias" #> views.map( view => "* *" #> aliasType(view.alias) & "* [data-viewid]" #> view.id )
|
||||
val descriptionSel = ".description" #> views.map( view => ".desc *" #> view.description.getOrElse("") & "* [data-viewid]" #> view.id )
|
||||
val isPublicSel = ".is_public *" #> getIfIsPublic()
|
||||
val addDeleteSel = ".delete" #> ids.map(x => "* [data-id]" #> x)
|
||||
val addEditSel = ".edit" #> ids.map(x => "* [data-id]" #> x)
|
||||
val addSaveSel = ".save" #> ids.map(x => ("* [data-id]" #> x) & saveOnClick(x))
|
||||
val addCancelSel = ".cancel" #> ids.map(x => "* [data-id]" #> x)
|
||||
|
||||
|
||||
val permissionNames = permissions.keys
|
||||
@ -98,56 +101,74 @@ class ViewsOverview(viewsDataJson: ViewsDataJSON) {
|
||||
addEditSel &
|
||||
addSaveSel &
|
||||
addCancelSel
|
||||
).apply(xhtml)
|
||||
}
|
||||
).apply(xhtml)
|
||||
}
|
||||
|
||||
def getIds(): List[String] = {
|
||||
views.map( view => view.id.getOrElse(""))
|
||||
}
|
||||
def getIds(): List[String] = {
|
||||
views.map( view => view.id.getOrElse(""))
|
||||
}
|
||||
|
||||
|
||||
def getIfIsPublic() :List[CssSel] = {
|
||||
views.map(
|
||||
view => {
|
||||
val isPublic = view.isPublic.getOrElse(false)
|
||||
val viewId: String = view.id.getOrElse("")
|
||||
val checked =
|
||||
if(isPublic)
|
||||
".is_public_cb [checked]" #> "checked" &
|
||||
".is_public_cb [disabled]" #> "disabled"
|
||||
def getIfIsPublic() :List[CssSel] = {
|
||||
views.map(
|
||||
view => {
|
||||
val isPublic = view.isPublic.getOrElse(false)
|
||||
val viewId: String = view.id.getOrElse("")
|
||||
val checked =
|
||||
if(isPublic)
|
||||
".is_public_cb [checked]" #> "checked" &
|
||||
".is_public_cb [disabled]" #> "disabled"
|
||||
else
|
||||
".is_public_cb [disabled]" #> "disabled"
|
||||
|
||||
val checkBox =
|
||||
checked &
|
||||
".is_public_cb [data-viewid]" #> viewId
|
||||
|
||||
checkBox
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
def getPermissionValues(permName: String) :List[CssSel] = {
|
||||
views.map(
|
||||
view => {
|
||||
val permValue: Boolean = view.permissions(permName)
|
||||
val viewId: String = view.id.getOrElse("")
|
||||
val checked =
|
||||
if(permValue){
|
||||
".permission_value_cb [checked]" #> "checked" &
|
||||
".permission_value_cb [disabled]" #> "disabled"
|
||||
}
|
||||
else
|
||||
".is_public_cb [disabled]" #> "disabled"
|
||||
".permission_value_cb [disabled]" #> "disabled"
|
||||
|
||||
val checkBox =
|
||||
checked &
|
||||
".is_public_cb [data-viewid]" #> viewId
|
||||
val checkBox =
|
||||
checked &
|
||||
".permission_value_cb [value]" #> permName &
|
||||
".permission_value_cb [name]" #> permName &
|
||||
".permission_value_cb [data-viewid]" #> viewId
|
||||
|
||||
checkBox
|
||||
}
|
||||
)
|
||||
checkBox
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
object AddView extends Loggable {
|
||||
def render = {
|
||||
var view_name = ""
|
||||
|
||||
def process(): JsCmd = {
|
||||
//TODO: Create new View
|
||||
//addView(bankId, accountId, view_name)
|
||||
}
|
||||
|
||||
def getPermissionValues(permName: String) :List[CssSel] = {
|
||||
views.map(
|
||||
view => {
|
||||
val permValue: Boolean = view.permissions(permName)
|
||||
val viewId: String = view.id.getOrElse("")
|
||||
val checked =
|
||||
if(permValue){
|
||||
".permission_value_cb [checked]" #> "checked" &
|
||||
".permission_value_cb [disabled]" #> "disabled"
|
||||
}
|
||||
else
|
||||
".permission_value_cb [disabled]" #> "disabled"
|
||||
|
||||
val checkBox =
|
||||
checked &
|
||||
".permission_value_cb [value]" #> permName &
|
||||
".permission_value_cb [name]" #> permName &
|
||||
".permission_value_cb [data-viewid]" #> viewId
|
||||
|
||||
checkBox
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// Bind view_name field to variable
|
||||
//(http://chimera.labs.oreilly.com/books/1234000000030/ch03.html)
|
||||
"@view_name" #> text(view_name, s => view_name = s) &
|
||||
// Replace the type=submit with Javascript that makes the ajax call.
|
||||
"type=submit" #> ajaxSubmit("OK", process)
|
||||
}
|
||||
}
|
||||
@ -37,13 +37,19 @@ See views.js for the javascript which manipulates the DOM for editing
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="lift:surround?with=default;at=content">
|
||||
<div class="views">
|
||||
<div class="lift:ViewsOverview.getTableContent" >
|
||||
<div>
|
||||
<button id="view-add">Add new view</button>
|
||||
<div id="add-view-form" class="lift:AddView">
|
||||
<form class="lift:form.ajax">
|
||||
<input type="text" name="view_name" placeholder="View name">
|
||||
<input type="submit" value="placeholder">
|
||||
</form>
|
||||
</div>
|
||||
<button id="view-edit-advanced-options">Show advanced options</button>
|
||||
</div>
|
||||
<div class="lift:ViewsOverview.getTableContent">
|
||||
<table id="view_table">
|
||||
<thead>
|
||||
<tr class="view_head">
|
||||
|
||||
@ -35,15 +35,6 @@ Berlin 13359, Germany
|
||||
|
||||
<div id="main" class="lift:surround?with=default;at=content">
|
||||
<div id="homeContent">
|
||||
<div id="public_accounts">
|
||||
<h2 class="account_header">Public Accounts</h2>
|
||||
<div class="lift:AccountsOverview.publicAccounts">
|
||||
<ul class="accountList">
|
||||
<li class="account"><a class="accLink" href="">Account Name</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="about_text">
|
||||
<p>
|
||||
Welcome to The Open Bank Project’s Social Finance web application.
|
||||
@ -60,11 +51,11 @@ Berlin 13359, Germany
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
Account holders can preserve privacy and commercial confidentiality
|
||||
Account holders can preserve privacy and commercial confidentiality
|
||||
by using aliases to protect the real names.
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<p>
|
||||
Once connected, account holders can also benefit from other applications
|
||||
that use the Open Bank Project API.
|
||||
</p>
|
||||
@ -77,12 +68,21 @@ Berlin 13359, Germany
|
||||
<p>
|
||||
We are an <a href="http://github.com/OpenBankProject" title ="Open bank project on Github" >open source project</a> backed by
|
||||
<a href="http://www.tesobe.com" title="TESOBE website">TESOBE</a>. More information is on our <a href="http://www.openbankproject.com/" title="Open Bank Project">home page</a>.
|
||||
|
||||
|
||||
</p>
|
||||
-->
|
||||
|
||||
</div>
|
||||
<div id="authorised_accounts">
|
||||
<div id="public_accounts">
|
||||
<h2 class="account_header">Public Accounts</h2>
|
||||
<div class="lift:AccountsOverview.publicAccounts">
|
||||
<ul class="accountList">
|
||||
<li class="account"><a class="accLink" href="">Account Name</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="authorised_accounts">
|
||||
<h2 class="account_header">Authorised Accounts</h2>
|
||||
<div class="lift:AccountsOverview.authorisedAccounts">
|
||||
<ul class="accountList">
|
||||
|
||||
@ -124,9 +124,8 @@ input.submit {
|
||||
text-align: justify;
|
||||
width: 500px;
|
||||
margin-top: 15px;
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
#nav ul {
|
||||
@ -535,12 +534,12 @@ span.edit_error_class {
|
||||
}
|
||||
|
||||
#public_accounts, #authorised_accounts {
|
||||
background: #FAFAFA;
|
||||
width: 200px;
|
||||
background: #FAFAFA;
|
||||
width: 45%;
|
||||
border-radius: 8px 8px 8px 8px;
|
||||
padding: 10px 10px 20px 10px;
|
||||
margin-top: 20px;
|
||||
padding: 12px 10px 20px 15px;
|
||||
float: left;
|
||||
margin: 20px 15px 0px 10px;
|
||||
}
|
||||
|
||||
#homeContent {
|
||||
@ -553,7 +552,7 @@ span.edit_error_class {
|
||||
|
||||
.account {
|
||||
margin-bottom: 5px;
|
||||
//white-space: nowrap;
|
||||
/* white-space: nowrap; */
|
||||
white-space: normal;
|
||||
word-wrap: break-word;
|
||||
overflow: hidden;
|
||||
@ -929,6 +928,10 @@ td.main-attributes{
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#add-view-form {
|
||||
display: none;
|
||||
}
|
||||
|
||||
td.imageURL {
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
@ -1,20 +1,25 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#view-edit-advanced-options').click(function(){
|
||||
var thisButton = $(this)
|
||||
var showButtonText = "Show advanced options"
|
||||
var thisButton = $(this)
|
||||
var showButtonText = "Show advanced options"
|
||||
|
||||
if(thisButton.text() === showButtonText) {
|
||||
|
||||
$('.advanced-option').show();
|
||||
|
||||
thisButton.text("Hide advanced options");
|
||||
if(thisButton.text() === showButtonText) {
|
||||
$('.advanced-option').show();
|
||||
thisButton.text("Hide advanced options");
|
||||
} else {
|
||||
|
||||
$('.advanced-option').hide();
|
||||
|
||||
thisButton.text(showButtonText);
|
||||
}
|
||||
$('.advanced-option').hide();
|
||||
thisButton.text(showButtonText);
|
||||
}
|
||||
})
|
||||
|
||||
$('#view-add').click(function(){
|
||||
var el = $('#add-view-form')
|
||||
if (el.is(":visible")) {
|
||||
el.hide()
|
||||
} else {
|
||||
el.css("display", "inline-block")
|
||||
}
|
||||
})
|
||||
|
||||
/* clicking on edit: change view to edit mode for selected view */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user