added UI for restricted scopes

pull/779/head
Justin Richer 2015-02-18 10:47:30 -05:00
parent 6885713eed
commit cf07f75682
3 changed files with 16 additions and 16 deletions

View File

@ -277,8 +277,8 @@
"default-help": "Newly-created clients get this scope by default?",
"description-help": "Human-readable text description",
"description-placeholder": "Type a description",
"dynamic": "allow dynamic registration",
"dynamic-help": "Allow dynamically registered clients to request this scope?",
"restricted": "restricted",
"restricted-help": "Restricted scopes are only usable by system administrators and are unavailable to dynamically registered clients and protected resources",
"edit": "Edit Scope",
"icon": "Icon",
"new": "New Scope",

View File

@ -23,7 +23,7 @@ var SystemScopeModel = Backbone.Model.extend({
icon:null,
value:null,
defaultScope:false,
allowDynReg:false,
restricted:false,
structured:false,
structuredParamDescription:null,
structuredValue:null
@ -46,18 +46,18 @@ var SystemScopeCollection = Backbone.Collection.extend({
return new SystemScopeCollection(filtered);
},
dynRegScopes: function() {
unrestrictedScopes: function() {
filtered = this.filter(function(scope) {
return scope.get("allowDynReg") === true;
return scope.get("restricted") !== true;
});
return new SystemScopeCollection(filtered);
},
defaultDynRegScopes: function() {
defaultUnrestrictedScopes: function() {
filtered = this.filter(function(scope) {
return scope.get("defaultScope") === true && scope.get("allowDynReg") === true;
return scope.get("defaultScope") === true && scope.get("restricted") !== true;
});
return new SystemScopeCollection(filtered);
return new SystemScopeCollection(filtered);
},
getByValue: function(value) {
@ -99,7 +99,7 @@ var SystemScopeView = Backbone.View.extend({
render:function (eventName) {
this.$el.html(this.template(this.model.toJSON()));
this.$('.allow-dyn-reg').tooltip({title: $.t('scope.system-scope-table.tooltip-dynamic')});
this.$('.restricted').tooltip({title: $.t('scope.system-scope-table.tooltip-restricted')});
return this;
$(this.el).i18n();
@ -306,7 +306,7 @@ var SystemScopeFormView = Backbone.View.extend({
description:$('#description textarea').val(),
icon:$('#iconDisplay input').val(),
defaultScope:$('#defaultScope input').is(':checked'),
allowDynReg:$('#allowDynReg input').is(':checked'),
restricted:$('#restricted input').is(':checked'),
structured:$('#isStructured input').is(':checked'),
structuredParamDescription:$('#structuredParamDescription input').val()
});

View File

@ -47,8 +47,8 @@
<script type="text/html" id="tmpl-system-scope">
<td>
<% if (allowDynReg) { %>
<span class="label label-inverse allow-dyn-reg"><i class="icon-globe icon-white"></i></span>
<% if (restricted) { %>
<span class="label label-warning restricted"><i class="icon-ban-circle icon-white"></i></span>
<% } %>
</td>
@ -141,12 +141,12 @@
</div>
</div>
<div class="control-group" id="allowDynReg">
<div class="control-group" id="restricted">
<div class="controls">
<label class="checkbox">
<input type="checkbox" <%-allowDynReg ? 'checked' : '' %>> <span data-i18n="scope.system-scope-form.dynamic">allow dynamic registration</span>
<input type="checkbox" <%-restricted ? 'checked' : '' %>> <span data-i18n="scope.system-scope-form.restricted">restricted</span>
</label>
<p class="help-block" data-i18n="scope.system-scope-form.dynamic-help">Allow dynamically registered clients to request this scope?</p>
<p class="help-block" data-i18n="scope.system-scope-form.restricted-help">Restricted scopes are only usable by system administrators and are unavailable to dynamically registered clients and protected resources</p>
</div>
</div>
@ -209,7 +209,7 @@ _.each(scopes, function(s) {
if (ss) {
%>
<span class="badge badge-info"
<span class="badge badge-<%-ss.get('restricted') ? 'warning' : 'info'%>"
<% if (ss.get('description')) { %>
title="<%- ss.get('description') %>"
<% } %>