launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06619
[Merge] lp:~wallyworld/launchpad/fix-sharing-terminology-948083 into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/fix-sharing-terminology-948083 into lp:launchpad with lp:~wallyworld/launchpad/delete-pillar-observer-947947 as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #948083 in Launchpad itself: "Sharing terminology is used inconsistently"
https://bugs.launchpad.net/launchpad/+bug/948083
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/fix-sharing-terminology-948083/+merge/96506
== Implementation ==
Fix terminology used for package names, modules, class names, variables, and parameters etc for sharing portion of the disclosure project.
eg
disclosure -> sharing
observer -> sharee
addPillarObserver -> addPillarSharee
AccessPolicyService -> SharingService
etc
== Tests ==
No new tests required.
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/canonical/launchpad/icing/css/components/sharing.css
lib/lp/registry/browser/pillar.py
lib/lp/registry/browser/tests/test_pillar_sharing.py
lib/lp/registry/interfaces/sharingservice.py
lib/lp/registry/interfaces/webservice.py
lib/lp/registry/javascript/sharing/pillarsharingview.js
lib/lp/registry/javascript/sharing/shareepicker.js
lib/lp/registry/javascript/sharing/shareetable.js
lib/lp/registry/javascript/sharing/tests/test_pillarsharingview.html
lib/lp/registry/javascript/sharing/tests/test_pillarsharingview.js
lib/lp/registry/javascript/sharing/tests/test_shareepicker.html
lib/lp/registry/javascript/sharing/tests/test_shareepicker.js
lib/lp/registry/javascript/sharing/tests/test_shareetable.html
lib/lp/registry/javascript/sharing/tests/test_shareetable.js
lib/lp/registry/services/configure.zcml
lib/lp/registry/services/sharingservice.py
lib/lp/registry/services/tests/test_sharingservice.py
lib/lp/registry/templates/pillar-sharing.pt
--
https://code.launchpad.net/~wallyworld/launchpad/fix-sharing-terminology-948083/+merge/96506
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/fix-sharing-terminology-948083 into lp:launchpad.
=== renamed file 'lib/canonical/launchpad/icing/css/components/disclosure.css' => 'lib/canonical/launchpad/icing/css/components/sharing.css'
--- lib/canonical/launchpad/icing/css/components/disclosure.css 2012-02-24 11:44:17 +0000
+++ lib/canonical/launchpad/icing/css/components/sharing.css 2012-03-08 03:22:19 +0000
@@ -1,16 +1,16 @@
-table.disclosure td {
+table.sharing td {
padding: 0;
margin: 0;
}
-table.disclosure ul {
+table.sharing ul {
margin-top: 3px
}
-table.disclosure ul.horizontal li {
+table.sharing ul.horizontal li {
display: inline;
list-style-type: none;
padding-right: 10px;
}
-table.disclosure ul.horizontal li div {
+table.sharing ul.horizontal li div {
display: inline;
-moz-border-radius: 5px;
-o-border-radius: 5px;
@@ -20,6 +20,6 @@
width: auto;
overflow: hidden;
}
-table.disclosure tr.spacebefore > td {
+table.sharing tr.spacebefore > td {
padding-top: 1em;
}
=== modified file 'lib/lp/registry/browser/pillar.py'
--- lib/lp/registry/browser/pillar.py 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/browser/pillar.py 2012-03-08 03:22:19 +0000
@@ -236,16 +236,16 @@
page_title = "Sharing"
label = "Sharing information"
- def _getAccessPolicyService(self):
- return getUtility(IService, 'accesspolicy')
+ def _getSharingService(self):
+ return getUtility(IService, 'sharing')
@property
def information_types(self):
- return self._getAccessPolicyService().getInformationTypes(self.context)
+ return self._getSharingService().getInformationTypes(self.context)
@property
def sharing_permissions(self):
- return self._getAccessPolicyService().getSharingPermissions()
+ return self._getSharingService().getSharingPermissions()
@cachedproperty
def sharing_vocabulary(self):
@@ -271,8 +271,8 @@
self.sharing_picker_config, cls=ResourceJSONEncoder)
@property
- def observer_data(self):
- return self._getAccessPolicyService().getPillarObservers(self.context)
+ def sharee_data(self):
+ return self._getSharingService().getPillarSharees(self.context)
def initialize(self):
super(PillarSharingView, self).initialize()
@@ -281,4 +281,4 @@
cache = IJSONRequestCache(self.request)
cache.objects['information_types'] = self.information_types
cache.objects['sharing_permissions'] = self.sharing_permissions
- cache.objects['observer_data'] = self.observer_data
+ cache.objects['sharee_data'] = self.sharee_data
=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
--- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-03-08 03:22:19 +0000
@@ -83,8 +83,8 @@
cache = IJSONRequestCache(view.request)
self.assertIsNotNone(cache.objects.get('information_types'))
self.assertIsNotNone(cache.objects.get('sharing_permissions'))
- aps = getUtility(IService, 'accesspolicy')
- observers = aps.getPillarObservers(self.pillar)
+ aps = getUtility(IService, 'sharing')
+ observers = aps.getPillarSharees(self.pillar)
self.assertEqual(observers, cache.objects.get('observer_data'))
=== renamed file 'lib/lp/registry/interfaces/accesspolicyservice.py' => 'lib/lp/registry/interfaces/sharingservice.py'
--- lib/lp/registry/interfaces/accesspolicyservice.py 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/interfaces/sharingservice.py 2012-03-08 03:22:19 +0000
@@ -1,13 +1,13 @@
-# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-"""Interfaces for access policy service."""
+"""Interfaces for sharing service."""
__metaclass__ = type
__all__ = [
- 'IAccessPolicyService',
+ 'ISharingService',
]
from lazr.restful.declarations import (
@@ -32,7 +32,7 @@
from lp.registry.interfaces.pillar import IPillar
-class IAccessPolicyService(IService):
+class ISharingService(IService):
# XXX 2012-02-24 wallyworld bug 939910
# Need to export for version 'beta' even though we only want to use it in
@@ -49,31 +49,31 @@
@operation_parameters(
pillar=Reference(IPillar, title=_('Pillar'), required=True))
@operation_for_version('devel')
- def getPillarObservers(pillar):
+ def getPillarSharees(pillar):
"""Return people/teams who can see pillar artifacts."""
@export_write_operation()
@call_with(user=REQUEST_USER)
@operation_parameters(
pillar=Reference(IPillar, title=_('Pillar'), required=True),
- observer=Reference(IPerson, title=_('Observer'), required=True),
+ sharee=Reference(IPerson, title=_('Sharee'), required=True),
information_types=List(Choice(vocabulary=InformationType)))
@operation_for_version('devel')
- def updatePillarObserver(pillar, observer, information_types, user):
- """Ensure observer has the grants for information types on a pillar."""
+ def updatePillarSharee(pillar, sharee, information_types, user):
+ """Ensure sharee has the grants for information types on a pillar."""
@export_write_operation()
@operation_parameters(
pillar=Reference(IPillar, title=_('Pillar'), required=True),
- observer=Reference(IPerson, title=_('Observer'), required=True),
+ sharee=Reference(IPerson, title=_('Sharee'), required=True),
information_types=List(
Choice(vocabulary=InformationType), required=False))
@operation_for_version('devel')
- def deletePillarObserver(pillar, observer, information_types):
- """Remove an observer from a pillar.
+ def deletePillarSharee(pillar, sharee, information_types):
+ """Remove a sharee from a pillar.
:param pillar: the pillar from which to remove access
- :param observer: the person or team to remove
+ :param sharee: the person or team to remove
:param information_types: if None, remove all access, otherwise just
remove the specified access_policies
"""
=== modified file 'lib/lp/registry/interfaces/webservice.py'
--- lib/lp/registry/interfaces/webservice.py 2012-02-28 05:36:01 +0000
+++ lib/lp/registry/interfaces/webservice.py 2012-03-08 03:22:19 +0000
@@ -4,8 +4,6 @@
"""All the interfaces that are exposed through the webservice."""
__all__ = [
- 'IAccessPolicyService',
- 'IServiceFactory',
'DerivationError',
'ICommercialSubscription',
'IDistribution',
@@ -31,6 +29,8 @@
'IProductSet',
'IProjectGroup',
'IProjectGroupSet',
+ 'IServiceFactory',
+ 'ISharingService',
'ISSHKey',
'ISourcePackage',
'ISourcePackageName',
@@ -44,7 +44,7 @@
# import bugs. Break this up into a per-package thing.
from lp import _schema_circular_imports
from lp.app.interfaces.services import IServiceFactory
-from lp.registry.interfaces.accesspolicyservice import IAccessPolicyService
+from lp.registry.interfaces.sharingservice import ISharingService
from lp.registry.interfaces.commercialsubscription import (
ICommercialSubscription,
)
=== renamed directory 'lib/lp/registry/javascript/disclosure' => 'lib/lp/registry/javascript/sharing'
=== modified file 'lib/lp/registry/javascript/sharing/pillarsharingview.js'
--- lib/lp/registry/javascript/disclosure/pillarsharingview.js 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/javascript/sharing/pillarsharingview.js 2012-03-08 03:22:19 +0000
@@ -3,12 +3,12 @@
*
* Disclosure infrastructure.
*
- * @module lp.registry.disclosure
+ * @module lp.registry.sharing
*/
-YUI.add('lp.registry.disclosure.pillarsharingview', function(Y) {
+YUI.add('lp.registry.sharing.pillarsharingview', function(Y) {
-var namespace = Y.namespace('lp.registry.disclosure.pillarsharingview');
+var namespace = Y.namespace('lp.registry.sharing.pillarsharingview');
function PillarSharingView(config) {
PillarSharingView.superclass.constructor.apply(this, arguments);
@@ -19,11 +19,11 @@
value: new Y.lp.client.Launchpad()
},
- observer_picker: {
+ sharee_picker: {
value: null
},
- observer_table: {
+ sharee_table: {
value: null
}
};
@@ -59,10 +59,10 @@
self.save_sharing_selection(result);
}
});
- var ns = Y.lp.registry.disclosure.observerpicker;
- var picker = new ns.ObserverPicker(new_config);
+ var ns = Y.lp.registry.sharing.shareepicker;
+ var picker = new ns.ShareePicker(new_config);
Y.lp.app.picker.setup_vocab_picker(picker, vocab, new_config);
- this.set('observer_picker', picker);
+ this.set('sharee_picker', picker);
},
destructor: function() { },
@@ -73,29 +73,29 @@
information_types[info_type.value] = info_type.title;
});
var sharing_permissions = LP.cache.sharing_permissions;
- var observer_data = LP.cache.observer_data;
- var otns = Y.lp.registry.disclosure.observertable;
- var observer_table = new otns.ObserverTableWidget({
- observers: observer_data,
+ var sharee_data = LP.cache.sharee_data;
+ var otns = Y.lp.registry.sharing.shareetable;
+ var sharee_table = new otns.ShareeTableWidget({
+ sharees: sharee_data,
sharing_permissions: sharing_permissions,
information_types: information_types
});
- this.set('observer_table', observer_table);
- observer_table.render();
+ this.set('sharee_table', sharee_table);
+ sharee_table.render();
},
bindUI: function() {
var self = this;
- var share_link = Y.one('#add-observer-link');
+ var share_link = Y.one('#add-sharee-link');
share_link.on('click', function(e) {
e.preventDefault();
- self.get('observer_picker').show();
+ self.get('sharee_picker').show();
});
- var observer_table = this.get('observer_table');
- var otns = Y.lp.registry.disclosure.observertable;
- observer_table.subscribe(
- otns.ObserverTableWidget.REMOVE_OBSERVER, function(e) {
- self.confirm_observer_removal(
+ var sharee_table = this.get('sharee_table');
+ var otns = Y.lp.registry.sharing.shareetable;
+ sharee_table.subscribe(
+ otns.ShareeTableWidget.REMOVE_SHAREE, function(e) {
+ self.confirm_sharee_removal(
e.details[0], e.details[1], e.details[2]);
});
},
@@ -130,11 +130,11 @@
},
/**
- * Prompt the user to confirm the removal of the selected observer.
+ * Prompt the user to confirm the removal of the selected sharee.
*
- * @method confirm_observer_removal
+ * @method confirm_sharee_removal
*/
- confirm_observer_removal: function(delete_link, person_uri, person_name) {
+ confirm_sharee_removal: function(delete_link, person_uri, person_name) {
var confirm_text_template = [
'<p class="large-warning" style="padding:2px 2px 0 36px;">',
' Do you really want to stop sharing',
@@ -147,7 +147,7 @@
var self = this;
var co = new Y.lp.app.confirmationoverlay.ConfirmationOverlay({
submit_fn: function() {
- self.perform_remove_observer(delete_link, person_uri);
+ self.perform_remove_sharee(delete_link, person_uri);
},
form_content: confirm_text,
headerContent: '<h2>Stop sharing</h2>'
@@ -156,30 +156,30 @@
},
/**
- * The server call to remove the specified observer has succeeded.
+ * The server call to remove the specified sharee has succeeded.
* Update the model and view.
- * @method remove_observer_success
+ * @method remove_sharee_success
* @param person_uri
*/
- remove_observer_success: function(person_uri) {
- var observer_table = this.get('observer_table');
- var observer_data = LP.cache.observer_data;
- Y.Array.some(observer_data, function(observer, index) {
- if (observer.self_link === person_uri) {
- observer_data.splice(index, 1);
- observer_table.delete_observer(observer);
+ remove_sharee_success: function(person_uri) {
+ var sharee_table = this.get('sharee_table');
+ var sharee_data = LP.cache.sharee_data;
+ Y.Array.some(sharee_data, function(sharee, index) {
+ if (sharee.self_link === person_uri) {
+ sharee_data.splice(index, 1);
+ sharee_table.delete_sharee(sharee);
return true;
}
});
},
/**
- * Make a server call to remove the specified observer.
- * @method perform_remove_observer
+ * Make a server call to remove the specified sharee.
+ * @method perform_remove_sharee
* @param delete_link
* @param person_uri
*/
- perform_remove_observer: function(delete_link, person_uri) {
+ perform_remove_sharee: function(delete_link, person_uri) {
var error_handler = new Y.lp.client.ErrorHandler();
var pillar_uri = LP.cache.context.self_link;
var self = this;
@@ -189,17 +189,17 @@
self._show_delete_spinner, namespace, delete_link),
end: Y.bind(self._hide_delete_spinner, namespace, delete_link),
success: function() {
- self.remove_observer_success(person_uri);
+ self.remove_sharee_success(person_uri);
},
failure: error_handler.getFailureHandler()
},
parameters: {
pillar: pillar_uri,
- observer: person_uri
+ sharee: person_uri
}
};
this.get('lp_client').named_post(
- '/+services/accesspolicy', 'deletePillarObserver', y_config);
+ '/+services/sharing', 'deletePillarSharee', y_config);
},
/**
@@ -210,7 +210,7 @@
_show_sharing_spinner: function() {
var spinner_node = Y.Node.create(
'<img class="spinner" src="/@@/spinner" alt="Saving..." />');
- var sharing_header = Y.one('#observer-table th:nth-child(2)');
+ var sharing_header = Y.one('#sharee-table th:nth-child(2)');
sharing_header.appendChild(spinner_node, sharing_header);
},
@@ -220,29 +220,29 @@
* @method _hide_hiding_spinner
*/
_hide_hiding_spinner: function() {
- var spinner = Y.one('#observer-table th .spinner');
+ var spinner = Y.one('#sharee-table th .spinner');
if (spinner !== null) {
spinner.remove();
}
},
/**
- * The server call to add the specified observer has succeeded.
+ * The server call to add the specified sharee has succeeded.
* Update the model and view.
* @method save_sharing_selection_success
- * @param observer
+ * @param sharee
*/
- save_sharing_selection_success: function(observer) {
- var observer_table = this.get('observer_table');
- var observer_data = LP.cache.observer_data;
- observer_data.splice(0, 0, observer);
- observer_table.add_observer(observer);
+ save_sharing_selection_success: function(sharee) {
+ var sharee_table = this.get('sharee_table');
+ var sharee_data = LP.cache.sharee_data;
+ sharee_data.splice(0, 0, sharee);
+ sharee_table.add_sharee(sharee);
},
/**
- * Make a server call to add the specified observer and access policy.
+ * Make a server call to add the specified sharee and access policy.
* @method save_sharing_selection
- * @param selection_result the disclosure picker
+ * @param selection_result the sharing picker
*/
save_sharing_selection: function(selection_result) {
var error_handler = new Y.lp.client.ErrorHandler();
@@ -254,20 +254,20 @@
on: {
start: Y.bind(self._show_sharing_spinner, namespace),
end: Y.bind(self._hide_hiding_spinner, namespace),
- success: function(observer_entry) {
+ success: function(sharee_entry) {
self.save_sharing_selection_success(
- observer_entry.getAttrs());
+ sharee_entry.getAttrs());
},
failure: error_handler.getFailureHandler()
},
parameters: {
pillar: pillar_uri,
- observer: person_uri,
+ sharee: person_uri,
information_types: selection_result.information_types
}
};
this.get('lp_client').named_post(
- '/+services/accesspolicy', 'updatePillarObserver', y_config);
+ '/+services/sharing', 'updatePillarSharee', y_config);
}
});
@@ -276,7 +276,7 @@
}, "0.1", { "requires": [
'node', 'lp.client', 'lp.mustache', 'lazr.picker', 'lp.app.picker',
- 'lp.mustache', 'lp.registry.disclosure.observerpicker',
- 'lp.registry.disclosure.observertable', 'lp.app.confirmationoverlay'
+ 'lp.mustache', 'lp.registry.sharing.shareepicker',
+ 'lp.registry.sharing.shareetable', 'lp.app.confirmationoverlay'
]});
=== renamed file 'lib/lp/registry/javascript/disclosure/observerpicker.js' => 'lib/lp/registry/javascript/sharing/shareepicker.js'
--- lib/lp/registry/javascript/disclosure/observerpicker.js 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/javascript/sharing/shareepicker.js 2012-03-08 03:22:19 +0000
@@ -3,20 +3,20 @@
*
* Disclosure infrastructure.
*
- * @module lp.registry.disclosure
+ * @module lp.registry.sharing
*/
-YUI.add('lp.registry.disclosure.observerpicker', function(Y) {
-
-var namespace = Y.namespace('lp.registry.disclosure.observerpicker');
-
-var ObserverPicker;
-ObserverPicker = function() {
- ObserverPicker.superclass.constructor.apply(this, arguments);
+YUI.add('lp.registry.sharing.shareepicker', function(Y) {
+
+var namespace = Y.namespace('lp.registry.sharing.shareepicker');
+
+var ShareePicker;
+ShareePicker = function() {
+ ShareePicker.superclass.constructor.apply(this, arguments);
};
-ObserverPicker.ATTRS = {
+ShareePicker.ATTRS = {
/**
* The available information types.
*
@@ -34,9 +34,9 @@
};
-Y.extend(ObserverPicker, Y.lazr.picker.Picker, {
+Y.extend(ShareePicker, Y.lazr.picker.Picker, {
initializer: function(config) {
- ObserverPicker.superclass.initializer.apply(this, arguments);
+ ShareePicker.superclass.initializer.apply(this, arguments);
var information_types = [];
if (config !== undefined) {
if (config.information_types !== undefined) {
@@ -211,8 +211,8 @@
});
-ObserverPicker.NAME = 'observer_picker';
-namespace.ObserverPicker = ObserverPicker;
+ShareePicker.NAME = 'sharee_picker';
+namespace.ShareePicker = ShareePicker;
}, "0.1", { "requires": ['node', 'lp.mustache', 'lazr.picker'] });
=== renamed file 'lib/lp/registry/javascript/disclosure/observertable.js' => 'lib/lp/registry/javascript/sharing/shareetable.js'
--- lib/lp/registry/javascript/disclosure/observertable.js 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/javascript/sharing/shareetable.js 2012-03-08 03:22:19 +0000
@@ -1,36 +1,36 @@
/* Copyright 2012 Canonical Ltd. This software is licensed under the
* GNU Affero General Public License version 3 (see the file LICENSE).
*
- * Observer table widget.
+ * Sharee table widget.
*
- * @module lp.registry.disclosure.observertable
+ * @module lp.registry.sharing.shareetable
*/
-YUI.add('lp.registry.disclosure.observertable', function(Y) {
+YUI.add('lp.registry.sharing.shareetable', function(Y) {
-var namespace = Y.namespace('lp.registry.disclosure.observertable');
+var namespace = Y.namespace('lp.registry.sharing.shareetable');
var
- NAME = "observerTableWidget",
+ NAME = "shareeTableWidget",
// Events
- REMOVE_OBSERVER = 'removeObserver';
+ REMOVE_SHAREE = 'removeSharee';
/*
- * Observer table widget.
- * This widget displays the observers and their level of access to a product.
+ * Sharee table widget.
+ * This widget displays the sharees and their level of access to a product.
*/
-function ObserverTableWidget(config) {
- ObserverTableWidget.superclass.constructor.apply(this, arguments);
+function ShareeTableWidget(config) {
+ ShareeTableWidget.superclass.constructor.apply(this, arguments);
}
-ObserverTableWidget.ATTRS = {
+ShareeTableWidget.ATTRS = {
// The duration for various animations eg row deletion.
anim_duration: {
value: 1
},
- // The list of observers to display.
- observers: {
+ // The list of sharees to display.
+ sharees: {
value: []
},
// The information types: public, embargoedsecurity, userdata etc.
@@ -41,43 +41,43 @@
sharing_permissions: {
value: {}
},
- // The node holding the observer table.
- observer_table: {
+ // The node holding the sharee table.
+ sharee_table: {
getter: function() {
- return Y.one('#observer-table');
+ return Y.one('#sharee-table');
}
},
- // The handlebars template for the observer table.
- observer_table_template: {
+ // The handlebars template for the sharee table.
+ sharee_table_template: {
value: null
},
- // The handlebars template for the observer table rows.
- observer_row_template: {
+ // The handlebars template for the sharee table rows.
+ sharee_row_template: {
value: null
},
// The handlebars template for the each access policy item.
- observer_policy_template: {
+ sharee_policy_template: {
value: null
}
};
-Y.extend(ObserverTableWidget, Y.Widget, {
+Y.extend(ShareeTableWidget, Y.Widget, {
initializer: function(config) {
this.set(
- 'observer_table_template', this._observer_table_template());
- this.set(
- 'observer_row_template', this._observer_row_template());
- this.set(
- 'observer_policy_template', this._observer_policy_template());
- this.publish(REMOVE_OBSERVER);
+ 'sharee_table_template', this._sharee_table_template());
+ this.set(
+ 'sharee_row_template', this._sharee_row_template());
+ this.set(
+ 'sharee_policy_template', this._sharee_policy_template());
+ this.publish(REMOVE_SHAREE);
},
destructor: function() { },
- _observer_table_template: function() {
+ _sharee_table_template: function() {
return [
- '<table class="disclosure listing" id="observer-table">',
+ '<table class="sharing listing" id="sharee-table">',
' <thead>',
' <tr><th style="width: 33%" ' +
' colspan="2">User or Team</th>',
@@ -91,15 +91,15 @@
' <th style="width: " colspan="1">Shared items</th>',
' </tr>',
' </thead>',
- ' <tbody id="observer-table-body">',
- ' {{#observers}}',
- ' {{>observer_row}}',
- ' {{/observers}}',
+ ' <tbody id="sharee-table-body">',
+ ' {{#sharees}}',
+ ' {{>sharee_row}}',
+ ' {{/sharees}}',
' </tbody>',
'</table>'].join(' ');
},
- _observer_row_template: function() {
+ _sharee_row_template: function() {
return [
'<tr id="permission-{{name}}"><td>',
' <a href="{{web_link}}" class="sprite person">' +
@@ -107,7 +107,7 @@
' <span class="formHelp">{{role}}</span></a>',
'</td>',
'<td id="remove-{{name}}">',
- ' <a title="Share nothing with this user"',
+ ' <a title="Stop sharing with {{display_name}}"',
' href="#" class="sprite remove"' +
' data-self_link="{{self_link}}"' +
' data-person_name="{{display_name}}">',
@@ -116,7 +116,7 @@
'<td id="td-permission-{{name}}">',
' <span class="sortkey">1</span>',
' <ul class="horizontal">',
- ' {{>observer_access_policies}}',
+ ' {{>sharee_access_policies}}',
' </ul>',
'</td>',
'<td></td>',
@@ -125,10 +125,10 @@
'</tr>'].join(' ');
},
- _observer_policy_template: function() {
+ _sharee_policy_template: function() {
return [
'{{#information_types}}',
- '<li><span id="{{policy}}-permission-{{observer_name}}">',
+ '<li><span id="{{policy}}-permission-{{sharee_name}}">',
' <span class="value"></span>',
' <a class="editicon sprite edit" href="#"> </a>',
'</span></li>',
@@ -137,8 +137,8 @@
// Render the popup widget to pick the sharing permission for an
// access policy.
- render_observer_policy: function(
- observer, policy, current_value) {
+ render_sharee_policy: function(
+ sharee, policy, current_value) {
var information_types = this.get('information_types');
var sharing_permissions = this.get('sharing_permissions');
var choice_items = [];
@@ -154,9 +154,9 @@
});
});
- var id = 'permission-'+observer.name;
- var observer_row = this.get('observer_table').one('#' + id);
- var permission_node = observer_row.one('#td-' + id);
+ var id = 'permission-'+sharee.name;
+ var sharee_row = this.get('sharee_table').one('#' + id);
+ var permission_node = sharee_row.one('#td-' + id);
var contentBox = permission_node.one('#' + policy + '-' + id);
var value_location = contentBox.one('.value');
var editicon = permission_node.one('a.editicon');
@@ -167,7 +167,7 @@
editicon: editicon,
value: current_value,
title: "Share " + information_types[policy] + " with "
- + observer.display_name,
+ + sharee.display_name,
items: choice_items,
elementToFlash: contentBox,
backgroundColor: '#FFFF99'
@@ -175,98 +175,98 @@
permission_edit.render();
},
- // Render the access policy values for the observers.
+ // Render the access policy values for the sharees.
render_sharing_info: function() {
- var observers = this.get('observers');
+ var sharees = this.get('sharees');
var self = this;
- Y.Array.forEach(observers, function(observer) {
- self.render_observer_sharing_info(observer);
+ Y.Array.forEach(sharees, function(sharee) {
+ self.render_sharee_sharing_info(sharee);
});
},
- // Render the access policy values for an observer.
- render_observer_sharing_info: function(observer) {
- var observer_policies = observer.permissions;
+ // Render the access policy values for a sharee.
+ render_sharee_sharing_info: function(sharee) {
+ var sharee_policies = sharee.permissions;
var self = this;
- Y.each(observer_policies, function(policy_value, policy) {
- self.render_observer_policy(observer, policy, policy_value);
+ Y.each(sharee_policies, function(policy_value, policy) {
+ self.render_sharee_policy(sharee, policy, policy_value);
});
},
renderUI: function() {
var partials = {
- observer_access_policies:
- this.get('observer_policy_template'),
- observer_row: this.get('observer_row_template')
+ sharee_access_policies:
+ this.get('sharee_policy_template'),
+ sharee_row: this.get('sharee_row_template')
};
- var observers = this.get('observers');
- this._prepareObserverDisplayData(observers);
+ var sharees = this.get('sharees');
+ this._prepareShareeDisplayData(sharees);
var html = Y.lp.mustache.to_html(
- this.get('observer_table_template'),
- {observers: observers}, partials);
+ this.get('sharee_table_template'),
+ {sharees: sharees}, partials);
var table_node = Y.Node.create(html);
- this.get('observer_table').replace(table_node);
+ this.get('sharee_table').replace(table_node);
this.render_sharing_info();
},
bindUI: function() {
- // Bind the delete observer links.
+ // Bind the delete sharee links.
var self = this;
- this.get('observer_table').delegate('click', function(e) {
+ this.get('sharee_table').delegate('click', function(e) {
e.preventDefault();
var delete_link = e.currentTarget;
- var observer_link = delete_link.getAttribute('data-self_link');
+ var sharee_link = delete_link.getAttribute('data-self_link');
var person_name = delete_link.getAttribute('data-person_name');
- self.fire(REMOVE_OBSERVER, delete_link, observer_link, person_name);
+ self.fire(REMOVE_SHAREE, delete_link, sharee_link, person_name);
}, 'td[id^=remove-] a');
},
syncUI: function() { },
- // Transform the observer access policy data from the model into a form
+ // Transform the sharee access policy data from the model into a form
// that can be used with the handlebars template.
- _prepareObserverDisplayData: function(observers) {
- Y.Array.forEach(observers, function(observer) {
- var observer_policies = observer.permissions;
+ _prepareShareeDisplayData: function(sharees) {
+ Y.Array.forEach(sharees, function(sharee) {
+ var sharee_policies = sharee.permissions;
var info_types = [];
- Y.each(observer_policies, function(policy_value, policy) {
+ Y.each(sharee_policies, function(policy_value, policy) {
info_types.push({policy: policy,
- observer_name: observer.name});
+ sharee_name: sharee.name});
});
- observer.information_types = info_types;
+ sharee.information_types = info_types;
});
},
- // Add a new observer to the table.
- add_observer: function(observer) {
- this._prepareObserverDisplayData([observer]);
+ // Add a new sharee to the table.
+ add_sharee: function(sharee) {
+ this._prepareShareeDisplayData([sharee]);
var partials = {
- observer_access_policies:
- this.get('observer_policy_template')
+ sharee_access_policies:
+ this.get('sharee_policy_template')
};
var row_html = Y.lp.mustache.to_html(
- this.get('observer_row_template'), observer, partials);
+ this.get('sharee_row_template'), sharee, partials);
var new_table_row = Y.Node.create(row_html);
- var first_row = this.get('observer_table')
+ var first_row = this.get('sharee_table')
.one('tbody>:first-child');
var row_node;
if (Y.Lang.isValue(first_row)) {
row_node = first_row.insertBefore(new_table_row, first_row);
} else {
- row_node = this.get('observer_table').one('tbody')
+ row_node = this.get('sharee_table').one('tbody')
.appendChild(new_table_row);
}
- this.render_observer_sharing_info(observer);
+ this.render_sharee_sharing_info(sharee);
var anim_duration = this.get('anim_duration');
var anim = Y.lp.anim.green_flash(
{node: row_node, duration:anim_duration});
anim.run();
},
- // Delete the specified observer from the table.
- delete_observer: function(observer) {
- var table_row = this.get('observer_table')
- .one('tr[id=permission-' + observer.name + ']');
+ // Delete the specified sharee from the table.
+ delete_sharee: function(sharee) {
+ var table_row = this.get('sharee_table')
+ .one('tr[id=permission-' + sharee.name + ']');
if (!Y.Lang.isValue(table_row)) {
return;
}
@@ -284,11 +284,11 @@
}
});
-ObserverTableWidget.NAME = NAME;
-ObserverTableWidget.REMOVE_OBSERVER = REMOVE_OBSERVER;
-namespace.ObserverTableWidget = ObserverTableWidget;
+ShareeTableWidget.NAME = NAME;
+ShareeTableWidget.REMOVE_SHAREE = REMOVE_SHAREE;
+namespace.ShareeTableWidget = ShareeTableWidget;
}, "0.1", { "requires": [
'node', 'event', 'collection', 'lazr.choiceedit',
- 'lp.mustache', 'lp.registry.disclosure.observerpicker'] });
+ 'lp.mustache', 'lp.registry.sharing.shareepicker'] });
=== modified file 'lib/lp/registry/javascript/sharing/tests/test_pillarsharingview.html'
--- lib/lp/registry/javascript/disclosure/tests/test_pillarsharingview.html 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_pillarsharingview.html 2012-03-08 03:22:19 +0000
@@ -61,9 +61,9 @@
<script type="text/javascript"
src="../../../../../../build/js/lp/app/extras/extras.js"></script>
<script type="text/javascript"
- src="../../../../../../build/js/lp/registry/disclosure/observertable.js"></script>
+ src="../../../../../../build/js/lp/registry/sharing/shareetable.js"></script>
<script type="text/javascript"
- src="../../../../../../build/js/lp/registry/disclosure/observerpicker.js"></script>
+ src="../../../../../../build/js/lp/registry/sharing/shareepicker.js"></script>
<!-- The module under test. -->
<script type="text/javascript" src="../pillarsharingview.js"></script>
@@ -72,13 +72,13 @@
<script type="text/javascript" src="test_pillarsharingview.js"></script>
<script id="test-fixture" type="text/x-template">
- <table id='observer-table'></table>
- <a id='add-observer-link' class='sprite add js-action' href="#">Share</a>
+ <table id='sharee-table'></table>
+ <a id='add-sharee-link' class='sprite add js-action' href="#">Share</a>
</script>
</head>
<body class="yui3-skin-sam">
<ul id="suites">
- <li>lp.registry.disclosure.pillarsharingview.test</li>
+ <li>lp.registry.sharing.pillarsharingview.test</li>
</ul>
<div id='fixture'>
</div>
=== modified file 'lib/lp/registry/javascript/sharing/tests/test_pillarsharingview.js'
--- lib/lp/registry/javascript/disclosure/tests/test_pillarsharingview.js 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_pillarsharingview.js 2012-03-08 03:22:19 +0000
@@ -1,13 +1,13 @@
/* Copyright (c) 2012, Canonical Ltd. All rights reserved. */
-YUI.add('lp.registry.disclosure.pillarsharingview.test', function (Y) {
+YUI.add('lp.registry.sharing.pillarsharingview.test', function (Y) {
- var tests = Y.namespace('lp.registry.disclosure.pillarsharingview.test');
+ var tests = Y.namespace('lp.registry.sharing.pillarsharingview.test');
tests.suite = new Y.Test.Suite(
- 'lp.registry.disclosure.sharing Tests');
+ 'lp.registry.sharing.sharing Tests');
tests.suite.add(new Y.Test.Case({
- name: 'lp.registry.disclosure.sharing_tests',
+ name: 'lp.registry.sharing.sharing_tests',
setUp: function () {
Y.one('#fixture').appendChild(
@@ -16,7 +16,7 @@
links: {},
cache: {
context: {self_link: "~pillar" },
- observer_data: [
+ sharee_data: [
{'name': 'fred', 'display_name': 'Fred Bloggs',
'role': '(Maintainer)', web_link: '~fred',
'self_link': '~fred',
@@ -49,52 +49,52 @@
},
_create_Widget: function(cfg) {
- var ns = Y.lp.registry.disclosure.pillarsharingview;
+ var ns = Y.lp.registry.sharing.pillarsharingview;
return new ns.PillarSharingView(cfg);
},
test_library_exists: function () {
- Y.Assert.isObject(Y.lp.registry.disclosure.pillarsharingview,
+ Y.Assert.isObject(Y.lp.registry.sharing.pillarsharingview,
"We should be able to locate the " +
- "lp.registry.disclosure.pillarsharingview module");
+ "lp.registry.sharing.pillarsharingview module");
},
test_widget_can_be_instantiated: function() {
this.view = this._create_Widget();
Y.Assert.isInstanceOf(
- Y.lp.registry.disclosure.pillarsharingview.PillarSharingView,
+ Y.lp.registry.sharing.pillarsharingview.PillarSharingView,
this.view,
- "Observer table failed to be instantiated");
+ "Sharee table failed to be instantiated");
},
// The view is correctly rendered.
test_render: function() {
this.view = this._create_Widget();
this.view.render();
- // The observer table - we'll just check one row
+ // The sharee table - we'll just check one row
Y.Assert.isNotNull(
- Y.one('#observer-table tr[id=permission-fred]'));
- // The disclosure picker
- Y.Assert.isNotNull(Y.one('.yui3-observer_picker'));
+ Y.one('#sharee-table tr[id=permission-fred]'));
+ // The sharing picker
+ Y.Assert.isNotNull(Y.one('.yui3-sharee_picker'));
},
- // Clicking the sharing link opens the disclosure picker
+ // Clicking the sharing link opens the sharing picker
test_sharing_link_click: function() {
this.view = this._create_Widget();
this.view.render();
- Y.one('#add-observer-link').simulate('click');
+ Y.one('#add-sharee-link').simulate('click');
Y.Assert.isFalse(
- Y.one('.yui3-observer_picker')
- .hasClass('yui3-observer_picker-hidden'));
+ Y.one('.yui3-sharee_picker')
+ .hasClass('yui3-sharee_picker-hidden'));
},
- // Clicking a delete observer link calls the confirm_observer_removal
+ // Clicking a delete sharee link calls the confirm_sharee_removal
// method with the correct parameters.
- test_delete_observer_click: function() {
+ test_delete_sharee_click: function() {
this.view = this._create_Widget();
this.view.render();
var confirmRemove_called = false;
- this.view.confirm_observer_removal = function(
+ this.view.confirm_sharee_removal = function(
delete_link, person_uri, person_name) {
Y.Assert.areEqual('~fred', person_uri);
Y.Assert.areEqual('Fred Bloggs', person_name);
@@ -103,17 +103,17 @@
};
var delete_link_to_click =
- Y.one('#observer-table td[id=remove-fred] a');
+ Y.one('#sharee-table td[id=remove-fred] a');
delete_link_to_click.simulate('click');
Y.Assert.isTrue(confirmRemove_called);
},
//Test the behaviour of the removal confirmation dialog.
- _test_confirm_observer_removal: function(click_ok) {
+ _test_confirm_sharee_removal: function(click_ok) {
this.view = this._create_Widget();
this.view.render();
var performRemove_called = false;
- this.view.perform_remove_observer = function(
+ this.view.perform_remove_sharee = function(
delete_link, person_uri) {
Y.Assert.areEqual('~fred', person_uri);
Y.Assert.areEqual(delete_link, delete_link);
@@ -121,8 +121,8 @@
};
var delete_link =
- Y.one('#observer-table td[id=remove-fred] a');
- this.view.confirm_observer_removal(
+ Y.one('#sharee-table td[id=remove-fred] a');
+ this.view.confirm_sharee_removal(
delete_link, '~fred', 'Fred Bloggs');
var co = Y.one('.yui3-overlay.yui3-lp-app-confirmationoverlay');
var actions = co.one('.yui3-lazr-formoverlay-actions');
@@ -140,17 +140,17 @@
},
//Test the remove confirmation dialog when the user clicks Ok.
- test_confirm_observer_removal_ok: function() {
- this._test_confirm_observer_removal(true);
+ test_confirm_sharee_removal_ok: function() {
+ this._test_confirm_sharee_removal(true);
},
//Test the remove confirmation dialog when the user clicks Cancel.
- test_confirm_observer_removal_cancel: function() {
- this._test_confirm_observer_removal(false);
+ test_confirm_sharee_removal_cancel: function() {
+ this._test_confirm_sharee_removal(false);
},
- // The perform_remove_observer method makes the expected XHR calls.
- test_perform_remove_observer: function() {
+ // The perform_remove_sharee method makes the expected XHR calls.
+ test_perform_remove_sharee: function() {
var mockio = new Y.lp.testing.mockio.MockIo();
var lp_client = new Y.lp.client.Launchpad({
io_provider: mockio
@@ -159,47 +159,47 @@
lp_client: lp_client
});
this.view.render();
- var remove_observer_success_called = false;
+ var remove_sharee_success_called = false;
var self = this;
- this.view.remove_observer_success = function(person_uri) {
+ this.view.remove_sharee_success = function(person_uri) {
Y.Assert.areEqual('~fred', person_uri);
- remove_observer_success_called = true;
+ remove_sharee_success_called = true;
};
var delete_link =
- Y.one('#observer-table td[id=remove-fred] a');
- this.view.perform_remove_observer(delete_link, '~fred');
+ Y.one('#sharee-table td[id=remove-fred] a');
+ this.view.perform_remove_sharee(delete_link, '~fred');
Y.Assert.areEqual(
- '/api/devel/+services/accesspolicy',
+ '/api/devel/+services/sharing',
mockio.last_request.url);
Y.Assert.areEqual(
- 'ws.op=deletePillarObserver&pillar=~pillar' +
- '&observer=~fred',
+ 'ws.op=deletePillarSharee&pillar=~pillar' +
+ '&sharee=~fred',
mockio.last_request.config.data);
mockio.last_request.successJSON({});
- Y.Assert.isTrue(remove_observer_success_called);
+ Y.Assert.isTrue(remove_sharee_success_called);
},
- // The removeObserver callback updates the model and table.
- test_remove_observer_success: function() {
+ // The removeSharee callback updates the model and table.
+ test_remove_sharee_success: function() {
this.view = this._create_Widget({anim_duration: 0.001});
this.view.render();
- var delete_observer_called = false;
- var expected_observer = window.LP.cache.observer_data[0];
- var observer_table = this.view.get('observer_table');
- observer_table.delete_observer = function(observer) {
- Y.Assert.areEqual(expected_observer, observer);
- delete_observer_called = true;
+ var delete_sharee_called = false;
+ var expected_sharee = window.LP.cache.sharee_data[0];
+ var sharee_table = this.view.get('sharee_table');
+ sharee_table.delete_sharee = function(sharee) {
+ Y.Assert.areEqual(expected_sharee, sharee);
+ delete_sharee_called = true;
};
- this.view.remove_observer_success('~fred');
- Y.Assert.isTrue(delete_observer_called);
- Y.Array.each(window.LP.cache.observer_data,
- function(observer) {
- Y.Assert.areNotEqual('fred', observer.name);
+ this.view.remove_sharee_success('~fred');
+ Y.Assert.isTrue(delete_sharee_called);
+ Y.Array.each(window.LP.cache.sharee_data,
+ function(sharee) {
+ Y.Assert.areNotEqual('fred', sharee.name);
});
},
- // The perform_add_observer method makes the expected XHR calls.
- test_perform_add_observer: function() {
+ // The perform_add_sharee method makes the expected XHR calls.
+ test_perform_add_sharee: function() {
var mockio = new Y.lp.testing.mockio.MockIo();
var lp_client = new Y.lp.client.Launchpad({
io_provider: mockio
@@ -211,38 +211,38 @@
this.view.render();
var save_sharing_selection_success_called = false;
var self = this;
- this.view.save_sharing_selection_success = function(observer) {
- Y.Assert.areEqual('joe', observer.name);
+ this.view.save_sharing_selection_success = function(sharee) {
+ Y.Assert.areEqual('joe', sharee.name);
save_sharing_selection_success_called = true;
};
- // Use the picker to select a new observer and information type.
- var observer_picker = this.view.get('observer_picker');
+ // Use the picker to select a new sharee and information type.
+ var sharee_picker = this.view.get('sharee_picker');
var picker_results = [
{"value": "joe", "title": "Joe", "css": "sprite-person",
"description": "joe@xxxxxxxxxxx", "api_uri": "~/joe",
"metadata": "person"}];
- Y.one('#add-observer-link').simulate('click');
- observer_picker.set('results', picker_results);
- observer_picker.get('boundingBox').one(
+ Y.one('#add-sharee-link').simulate('click');
+ sharee_picker.set('results', picker_results);
+ sharee_picker.get('boundingBox').one(
'.yui3-picker-results li:nth-child(1)').simulate('click');
- var cb = observer_picker.get('contentBox');
+ var cb = sharee_picker.get('contentBox');
var step_two_content = cb.one('.picker-content-two');
step_two_content.one('input[value="Policy 2"]').simulate('click');
var select_link = step_two_content.one('a.next');
select_link.simulate('click');
// Selection made using the picker, now check the results.
Y.Assert.areEqual(
- '/api/devel/+services/accesspolicy',
+ '/api/devel/+services/sharing',
mockio.last_request.url);
var person_uri = Y.lp.client.normalize_uri('~/joe');
person_uri = Y.lp.client.get_absolute_uri(person_uri);
var expected_url;
expected_url = Y.lp.client.append_qs(
- expected_url, 'ws.op', 'updatePillarObserver');
+ expected_url, 'ws.op', 'updatePillarSharee');
expected_url = Y.lp.client.append_qs(
expected_url, 'pillar', '~pillar');
expected_url = Y.lp.client.append_qs(
- expected_url, 'observer', person_uri);
+ expected_url, 'sharee', person_uri);
expected_url = Y.lp.client.append_qs(
expected_url, 'information_types', ['Policy 2']);
Y.Assert.areEqual(expected_url, mockio.last_request.config.data);
@@ -258,21 +258,21 @@
test_save_sharing_selection_success: function() {
this.view = this._create_Widget({anim_duration: 0.001});
this.view.render();
- var add_observer_called = false;
- var new_observer = {
+ var add_sharee_called = false;
+ var new_sharee = {
'name': 'joe'
};
- var observer_table = this.view.get('observer_table');
- observer_table.add_observer = function(observer) {
- Y.Assert.areEqual(new_observer, observer);
- add_observer_called = true;
+ var sharee_table = this.view.get('sharee_table');
+ sharee_table.add_sharee = function(sharee) {
+ Y.Assert.areEqual(new_sharee, sharee);
+ add_sharee_called = true;
};
- this.view.save_sharing_selection_success(new_observer);
- Y.Assert.isTrue(add_observer_called);
+ this.view.save_sharing_selection_success(new_sharee);
+ Y.Assert.isTrue(add_sharee_called);
var model_updated = false;
- Y.Array.some(window.LP.cache.observer_data,
- function(observer) {
- model_updated = 'joe' === observer.name;
+ Y.Array.some(window.LP.cache.sharee_data,
+ function(sharee) {
+ model_updated = 'joe' === sharee.name;
return model_updated;
});
Y.Assert.isTrue(model_updated);
@@ -280,6 +280,6 @@
}));
}, '0.1', {'requires': ['test', 'console', 'event', 'node-event-simulate',
- 'lp.testing.mockio', 'lp.registry.disclosure.observerpicker',
- 'lp.registry.disclosure.observertable',
- 'lp.registry.disclosure.pillarsharingview']});
+ 'lp.testing.mockio', 'lp.registry.sharing.shareepicker',
+ 'lp.registry.sharing.shareetable',
+ 'lp.registry.sharing.pillarsharingview']});
=== renamed file 'lib/lp/registry/javascript/disclosure/tests/test_observerpicker.html' => 'lib/lp/registry/javascript/sharing/tests/test_shareepicker.html'
--- lib/lp/registry/javascript/disclosure/tests/test_observerpicker.html 2012-03-01 05:46:50 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_shareepicker.html 2012-03-08 03:22:19 +0000
@@ -7,7 +7,7 @@
<html>
<head>
- <title>Observer Picker Tests</title>
+ <title>Sharee Picker Tests</title>
<!-- YUI and test setup -->
<script type="text/javascript"
@@ -54,15 +54,15 @@
src="../../../../../../build/js/lp/app/extras/extras.js"></script>
<!-- The module under test. -->
- <script type="text/javascript" src="../observerpicker.js"></script>
+ <script type="text/javascript" src="../shareepicker.js"></script>
<!-- The test suite -->
- <script type="text/javascript" src="test_observerpicker.js"></script>
+ <script type="text/javascript" src="test_shareepicker.js"></script>
</head>
<body class="yui3-skin-sam">
<ul id="suites">
- <li>lp.registry.disclosure.observerpicker.test</li>
+ <li>lp.registry.sharing.shareepicker.test</li>
</ul>
</body>
</html>
=== renamed file 'lib/lp/registry/javascript/disclosure/tests/test_observerpicker.js' => 'lib/lp/registry/javascript/sharing/tests/test_shareepicker.js'
--- lib/lp/registry/javascript/disclosure/tests/test_observerpicker.js 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_shareepicker.js 2012-03-08 03:22:19 +0000
@@ -1,13 +1,13 @@
/* Copyright (c) 2012, Canonical Ltd. All rights reserved. */
-YUI.add('lp.registry.disclosure.observerpicker.test', function (Y) {
+YUI.add('lp.registry.sharing.shareepicker.test', function (Y) {
- var tests = Y.namespace('lp.registry.disclosure.observerpicker.test');
+ var tests = Y.namespace('lp.registry.sharing.shareepicker.test');
tests.suite = new Y.Test.Suite(
- 'lp.registry.disclosure.observerpicker Tests');
+ 'lp.registry.sharing.shareepicker Tests');
tests.suite.add(new Y.Test.Case({
- name: 'lp.registry.disclosure.observerpicker_tests',
+ name: 'lp.registry.sharing.shareepicker_tests',
setUp: function () {
this.vocabulary = [
@@ -59,22 +59,22 @@
if (overrides !== undefined) {
config = Y.merge(config, overrides);
}
- var ns = Y.lp.registry.disclosure.observerpicker;
- var picker = new ns.ObserverPicker(config);
+ var ns = Y.lp.registry.sharing.shareepicker;
+ var picker = new ns.ShareePicker(config);
Y.lp.app.picker.setup_vocab_picker(picker, "TestVocab", config);
return picker;
},
test_library_exists: function () {
- Y.Assert.isObject(Y.lp.registry.disclosure.observerpicker,
+ Y.Assert.isObject(Y.lp.registry.sharing.shareepicker,
"We should be able to locate the " +
- "lp.registry.disclosure module");
+ "lp.registry.sharing module");
},
test_picker_can_be_instantiated: function() {
this.picker = this._create_picker();
Y.Assert.isInstanceOf(
- Y.lp.registry.disclosure.observerpicker.ObserverPicker,
+ Y.lp.registry.sharing.shareepicker.ShareePicker,
this.picker,
"Picker failed to be instantiated");
},
@@ -177,4 +177,4 @@
}));
}, '0.1', {'requires': ['test', 'console', 'event', 'node-event-simulate',
- 'lp.app.picker', 'lp.registry.disclosure.observerpicker']});
+ 'lp.app.picker', 'lp.registry.sharing.shareepicker']});
=== renamed file 'lib/lp/registry/javascript/disclosure/tests/test_observertable.html' => 'lib/lp/registry/javascript/sharing/tests/test_shareetable.html'
--- lib/lp/registry/javascript/disclosure/tests/test_observertable.html 2012-03-06 00:17:34 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_shareetable.html 2012-03-08 03:22:19 +0000
@@ -7,7 +7,7 @@
<html>
<head>
- <title>Observer Table Widget Tests</title>
+ <title>Sharee Table Widget Tests</title>
<!-- YUI and test setup -->
<script type="text/javascript"
@@ -43,7 +43,7 @@
<script type="text/javascript"
src="../../../../../../build/js/lp/app/picker/person_picker.js"></script>
<script type="text/javascript"
- src="../../../../../../build/js/lp/registry/disclosure/observerpicker.js"></script>
+ src="../../../../../../build/js/lp/registry/sharing/shareepicker.js"></script>
<script type="text/javascript"
src="../../../../../../build/js/lp/app/picker/picker_patcher.js"></script>
<script type="text/javascript"
@@ -58,17 +58,17 @@
src="../../../../../../build/js/lp/app/extras/extras.js"></script>
<!-- The module under test. -->
- <script type="text/javascript" src="../observertable.js"></script>
+ <script type="text/javascript" src="../shareetable.js"></script>
<!-- The test suite -->
- <script type="text/javascript" src="test_observertable.js"></script>
+ <script type="text/javascript" src="test_shareetable.js"></script>
</head>
<body class="yui3-skin-sam">
<ul id="suites">
- <li>lp.registry.disclosure.observertable.test</li>
+ <li>lp.registry.sharing.shareetable.test</li>
</ul>
- <table id='observer-table'>
+ <table id='sharee-table'>
</table>
</body>
</html>
=== renamed file 'lib/lp/registry/javascript/disclosure/tests/test_observertable.js' => 'lib/lp/registry/javascript/sharing/tests/test_shareetable.js'
--- lib/lp/registry/javascript/disclosure/tests/test_observertable.js 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/javascript/sharing/tests/test_shareetable.js 2012-03-08 03:22:19 +0000
@@ -1,16 +1,16 @@
/* Copyright (c) 2012, Canonical Ltd. All rights reserved. */
-YUI.add('lp.registry.disclosure.observertable.test', function (Y) {
+YUI.add('lp.registry.sharing.shareetable.test', function (Y) {
- var tests = Y.namespace('lp.registry.disclosure.observertable.test');
+ var tests = Y.namespace('lp.registry.sharing.shareetable.test');
tests.suite = new Y.Test.Suite(
- 'lp.registry.disclosure.observertable Tests');
+ 'lp.registry.sharing.shareetable Tests');
tests.suite.add(new Y.Test.Case({
- name: 'lp.registry.disclosure.observertable_tests',
+ name: 'lp.registry.sharing.shareetable_tests',
setUp: function () {
- this.observer_data = [
+ this.sharee_data = [
{'name': 'fred', 'display_name': 'Fred Bloggs',
'role': '(Maintainer)', web_link: '~fred',
'self_link': '~fred',
@@ -33,113 +33,113 @@
},
tearDown: function () {
- Y.one('#observer-table').empty(true);
+ Y.one('#sharee-table').empty(true);
},
_create_Widget: function() {
- var ns = Y.lp.registry.disclosure.observertable;
- return new ns.ObserverTableWidget({
+ var ns = Y.lp.registry.sharing.shareetable;
+ return new ns.ShareeTableWidget({
anim_duration: 0.001,
- observers: this.observer_data,
+ sharees: this.sharee_data,
sharing_permissions: this.sharing_permissions,
information_types: this.information_types
});
},
test_library_exists: function () {
- Y.Assert.isObject(Y.lp.registry.disclosure.observertable,
+ Y.Assert.isObject(Y.lp.registry.sharing.shareetable,
"We should be able to locate the " +
- "lp.registry.disclosure.observertable module");
+ "lp.registry.sharing.shareetable module");
},
test_widget_can_be_instantiated: function() {
- this.observer_table = this._create_Widget();
+ this.sharee_table = this._create_Widget();
Y.Assert.isInstanceOf(
- Y.lp.registry.disclosure.observertable.ObserverTableWidget,
- this.observer_table,
- "Observer table failed to be instantiated");
+ Y.lp.registry.sharing.shareetable.ShareeTableWidget,
+ this.sharee_table,
+ "Sharee table failed to be instantiated");
},
- // The given observer is correctly rendered.
- _test_observer_rendered: function(observer) {
- // The observer row
+ // The given sharee is correctly rendered.
+ _test_sharee_rendered: function(sharee) {
+ // The sharee row
Y.Assert.isNotNull(
- Y.one('#observer-table tr[id=permission-'
- + observer.name + ']'));
+ Y.one('#sharee-table tr[id=permission-'
+ + sharee.name + ']'));
// The delete link
Y.Assert.isNotNull(
- Y.one('#observer-table td[id=remove-'
- + observer.name + '] a'));
+ Y.one('#sharee-table td[id=remove-'
+ + sharee.name + '] a'));
// The sharing permissions
var permission;
- for (permission in observer.permissions) {
- if (observer.permissions.hasOwnProperty(permission)) {
+ for (permission in sharee.permissions) {
+ if (sharee.permissions.hasOwnProperty(permission)) {
Y.Assert.isNotNull(
- Y.one('#observer-table td[id=td-permission-'
- + observer.name + '] ul li '
+ Y.one('#sharee-table td[id=td-permission-'
+ + sharee.name + '] ul li '
+ 'span[id='+permission+'-permission-'
- + observer.name + '] span.value'));
+ + sharee.name + '] span.value'));
}
}
},
- // The observer table is correctly rendered.
+ // The sharee table is correctly rendered.
test_render: function() {
- this.observer_table = this._create_Widget();
- this.observer_table.render();
+ this.sharee_table = this._create_Widget();
+ this.sharee_table.render();
var self = this;
- Y.Array.each(this.observer_data, function(observer) {
- self._test_observer_rendered(observer);
+ Y.Array.each(this.sharee_data, function(sharee) {
+ self._test_sharee_rendered(sharee);
});
},
- // The add_observer call adds the observer to the table.
- test_observer_add: function() {
- this.observer_table = this._create_Widget();
- this.observer_table.render();
- var new_observer = {
+ // The add_sharee call adds the sharee to the table.
+ test_sharee_add: function() {
+ this.sharee_table = this._create_Widget();
+ this.sharee_table.render();
+ var new_sharee = {
'name': 'joe', 'display_name': 'Joe Smith',
'role': '(Maintainer)', web_link: '~joe',
'self_link': '~joe',
'permissions': {'P1': 's2'}};
- this.observer_table.add_observer(new_observer);
+ this.sharee_table.add_sharee(new_sharee);
var self = this;
this.wait(function() {
- self._test_observer_rendered(new_observer);
+ self._test_sharee_rendered(new_sharee);
}, 60
);
},
// When the delete link is clicked, the correct event is published.
- test_observer_delete_click: function() {
- this.observer_table = this._create_Widget();
- this.observer_table.render();
+ test_sharee_delete_click: function() {
+ this.sharee_table = this._create_Widget();
+ this.sharee_table.render();
var event_fired = false;
- var ns = Y.lp.registry.disclosure.observertable;
- this.observer_table.subscribe(
- ns.ObserverTableWidget.REMOVE_OBSERVER, function(e) {
+ var ns = Y.lp.registry.sharing.shareetable;
+ this.sharee_table.subscribe(
+ ns.ShareeTableWidget.REMOVE_SHAREE, function(e) {
var delete_link = e.details[0];
- var observer_uri = e.details[1];
+ var sharee_uri = e.details[1];
var person_name = e.details[2];
- Y.Assert.areEqual('~fred', observer_uri);
+ Y.Assert.areEqual('~fred', sharee_uri);
Y.Assert.areEqual('Fred Bloggs', person_name);
Y.Assert.areEqual(delete_link_to_click, delete_link);
event_fired = true;
}
);
var delete_link_to_click =
- Y.one('#observer-table td[id=remove-fred] a');
+ Y.one('#sharee-table td[id=remove-fred] a');
delete_link_to_click.simulate('click');
Y.Assert.isTrue(event_fired);
},
- // The delete_observer call removes the observer from the table.
- test_observer_delete: function() {
- this.observer_table = this._create_Widget();
- this.observer_table.render();
- var row_selector = '#observer-table tr[id=permission-fred]';
+ // The delete_sharee call removes the sharee from the table.
+ test_sharee_delete: function() {
+ this.sharee_table = this._create_Widget();
+ this.sharee_table.render();
+ var row_selector = '#sharee-table tr[id=permission-fred]';
Y.Assert.isNotNull(Y.one(row_selector));
- this.observer_table.delete_observer(this.observer_data[0]);
+ this.sharee_table.delete_sharee(this.sharee_data[0]);
this.wait(function() {
Y.Assert.isNull(Y.one(row_selector));
}, 60
@@ -148,5 +148,5 @@
}));
}, '0.1', {'requires': ['test', 'console', 'event', 'node-event-simulate',
- 'lp.registry.disclosure.observertable',
- 'lp.registry.disclosure.observerpicker']});
+ 'lp.registry.sharing.shareetable',
+ 'lp.registry.sharing.shareepicker']});
=== modified file 'lib/lp/registry/services/configure.zcml'
--- lib/lp/registry/services/configure.zcml 2012-02-23 10:13:48 +0000
+++ lib/lp/registry/services/configure.zcml 2012-03-08 03:22:19 +0000
@@ -9,10 +9,10 @@
<!-- Named Services -->
<securedutility
- name="accesspolicy"
- class="lp.registry.services.accesspolicyservice.AccessPolicyService"
+ name="sharing"
+ class="lp.registry.services.sharingservice.SharingService"
provides="lp.app.interfaces.services.IService">
<allow
- interface="lp.registry.interfaces.accesspolicyservice.IAccessPolicyService"/>
+ interface="lp.registry.interfaces.sharingservice.ISharingService"/>
</securedutility>
</configure>
=== renamed file 'lib/lp/registry/services/accesspolicyservice.py' => 'lib/lp/registry/services/sharingservice.py'
--- lib/lp/registry/services/accesspolicyservice.py 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/services/sharingservice.py 2012-03-08 03:22:19 +0000
@@ -1,11 +1,11 @@
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-"""Classes for pillar and artifact access policy services."""
+"""Classes for pillar and artifact sharing service."""
__metaclass__ = type
__all__ = [
- 'AccessPolicyService',
+ 'SharingService',
]
from lazr.restful import EntryResource
@@ -24,28 +24,28 @@
IAccessPolicyGrantFlatSource,
IAccessPolicyGrantSource,
)
-from lp.registry.interfaces.accesspolicyservice import IAccessPolicyService
+from lp.registry.interfaces.sharingservice import ISharingService
from lp.registry.interfaces.product import IProduct
from lp.registry.interfaces.projectgroup import IProjectGroup
from lp.services.webapp.authorization import available_with_permission
-class AccessPolicyService:
- """Service providing operations for adding and removing pillar observers.
+class SharingService:
+ """Service providing operations for adding and removing pillar sharees.
Service is accessed via a url of the form
- '/services/accesspolicy?ws.op=...
+ '/services/sharing?ws.op=...
"""
- implements(IAccessPolicyService)
+ implements(ISharingService)
@property
def name(self):
"""See `IService`."""
- return 'accesspolicy'
+ return 'sharing'
def getInformationTypes(self, pillar):
- """See `IAccessPolicyService`."""
+ """See `ISharingService`."""
allowed_types = [
InformationType.EMBARGOEDSECURITY,
InformationType.USERDATA]
@@ -67,7 +67,7 @@
return result_data
def getSharingPermissions(self):
- """See `IAccessPolicyService`."""
+ """See `ISharingService`."""
sharing_permissions = []
for permission in SharingPermission:
item = dict(
@@ -79,8 +79,8 @@
return sharing_permissions
@available_with_permission('launchpad.Driver', 'pillar')
- def getPillarObservers(self, pillar):
- """See `IAccessPolicyService`."""
+ def getPillarSharees(self, pillar):
+ """See `ISharingService`."""
# Currently support querying for sharing_permission = ALL
# TODO - support querying for sharing_permission = SOME
@@ -105,11 +105,11 @@
return result
@available_with_permission('launchpad.Edit', 'pillar')
- def updatePillarObserver(self, pillar, observer, information_types,
+ def updatePillarSharee(self, pillar, sharee, information_types,
user):
- """See `IAccessPolicyService`."""
+ """See `ISharingService`."""
- # We do not support adding observers to project groups.
+ # We do not support adding sharees to project groups.
assert not IProjectGroup.providedBy(pillar)
pillar_info_types = [
@@ -129,7 +129,7 @@
# We have the policies, we need to figure out which grants we need to
# create. We also need to revoke any grants which are not required.
policy_grant_source = getUtility(IAccessPolicyGrantSource)
- policy_grants = [(policy, observer) for policy in pillar_policies]
+ policy_grants = [(policy, sharee) for policy in pillar_policies]
existing_grants = [
(grant.policy, grant.grantee)
for grant in policy_grant_source.find(policy_grants)]
@@ -137,7 +137,7 @@
all_pillar_policies = policy_source.findByPillar([pillar])
possible_policy_grants = [
- (policy, observer) for policy in all_pillar_policies]
+ (policy, sharee) for policy in all_pillar_policies]
possible_grants = [
(grant.policy, grant.grantee)
for grant in policy_grant_source.find(possible_policy_grants)]
@@ -145,15 +145,15 @@
grants_to_revoke = set(possible_grants).difference(policy_grants)
# Create any newly required grants.
if len(required_grants) > 0:
- policy_grant_source.grant([(policy, observer, user)
- for policy, observer in required_grants])
+ policy_grant_source.grant([(policy, sharee, user)
+ for policy, sharee in required_grants])
# Now revoke any existing grants no longer required.
if len(grants_to_revoke) > 0:
policy_grant_source.revoke(grants_to_revoke)
- # Return observer data to the caller.
+ # Return sharee data to the caller.
request = get_current_web_service_request()
- resource = EntryResource(observer, request)
+ resource = EntryResource(sharee, request)
person_data = resource.toDataForJSON()
permissions = {}
for information_type in information_types:
@@ -162,9 +162,9 @@
return person_data
@available_with_permission('launchpad.Edit', 'pillar')
- def deletePillarObserver(self, pillar, observer,
+ def deletePillarSharee(self, pillar, sharee,
information_types=None):
- """See `IAccessPolicyService`."""
+ """See `ISharingService`."""
policy_source = getUtility(IAccessPolicySource)
if information_types is None:
@@ -179,7 +179,7 @@
# First delete any access policy grants.
policy_grant_source = getUtility(IAccessPolicyGrantSource)
- policy_grants = [(policy, observer) for policy in pillar_policies]
+ policy_grants = [(policy, sharee) for policy in pillar_policies]
grants = [
(grant.policy, grant.grantee)
for grant in policy_grant_source.find(policy_grants)]
@@ -188,6 +188,6 @@
# Second delete any access artifact grants.
ap_grant_flat = getUtility(IAccessPolicyGrantFlatSource)
to_delete = ap_grant_flat.findArtifactsByGrantee(
- observer, pillar_policies)
+ sharee, pillar_policies)
accessartifact_grant_source = getUtility(IAccessArtifactGrantSource)
accessartifact_grant_source.revokeByArtifact(to_delete)
=== renamed file 'lib/lp/registry/services/tests/test_accesspolicyservice.py' => 'lib/lp/registry/services/tests/test_sharingservice.py'
--- lib/lp/registry/services/tests/test_accesspolicyservice.py 2012-03-08 03:22:19 +0000
+++ lib/lp/registry/services/tests/test_sharingservice.py 2012-03-08 03:22:19 +0000
@@ -19,7 +19,7 @@
IAccessPolicyGrantSource,
IAccessPolicySource,
)
-from lp.registry.services.accesspolicyservice import AccessPolicyService
+from lp.registry.services.sharingservice import SharingService
from lp.services.webapp.interaction import ANONYMOUS
from lp.services.webapp.interfaces import ILaunchpadRoot
from lp.services.webapp.publisher import canonical_url
@@ -37,25 +37,25 @@
from lp.testing.pages import LaunchpadWebServiceCaller
-class TestAccessPolicyService(TestCaseWithFactory):
- """Tests for the AccessPolicyService."""
+class TestSharingService(TestCaseWithFactory):
+ """Tests for the SharingService."""
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestAccessPolicyService, self).setUp()
- self.service = getUtility(IService, 'accesspolicy')
+ super(TestSharingService, self).setUp()
+ self.service = getUtility(IService, 'sharing')
- def _makeObserverData(self, observer, policy_types):
- # Unpack an observer into its attributes and add in permissions.
+ def _makeShareeData(self, sharee, policy_types):
+ # Unpack a sharee into its attributes and add in permissions.
request = get_current_web_service_request()
- resource = EntryResource(observer, request)
- observer_data = resource.toDataForJSON()
+ resource = EntryResource(sharee, request)
+ sharee_data = resource.toDataForJSON()
permissions = {}
for policy in policy_types:
permissions[policy.name] = SharingPermission.ALL.name
- observer_data['permissions'] = permissions
- return observer_data
+ sharee_data['permissions'] = permissions
+ return sharee_data
def _test_getInformationTypes(self, pillar, expected_policies):
policy_data = self.service.getInformationTypes(pillar)
@@ -98,135 +98,135 @@
distro,
[InformationType.EMBARGOEDSECURITY, InformationType.USERDATA])
- def _test_getPillarObservers(self, pillar):
- # getPillarObservers returns the expected data.
+ def _test_getPillarSharees(self, pillar):
+ # getPillarSharees returns the expected data.
access_policy = self.factory.makeAccessPolicy(
pillar=pillar,
type=InformationType.PROPRIETARY)
grantee = self.factory.makePerson()
self.factory.makeAccessPolicyGrant(access_policy, grantee)
- [observer] = self.service.getPillarObservers(pillar)
- person_data = self._makeObserverData(
+ [sharee] = self.service.getPillarSharees(pillar)
+ person_data = self._makeShareeData(
grantee, [InformationType.PROPRIETARY])
- self.assertEqual(person_data, observer)
+ self.assertEqual(person_data, sharee)
- def test_getProductObservers(self):
- # Users with launchpad.Driver can view observers.
+ def test_getProductSharees(self):
+ # Users with launchpad.Driver can view sharees.
driver = self.factory.makePerson()
product = self.factory.makeProduct(driver=driver)
login_person(driver)
- self._test_getPillarObservers(product)
+ self._test_getPillarSharees(product)
- def test_getDistroObservers(self):
- # Users with launchpad.Driver can view observers.
+ def test_getDistroSharees(self):
+ # Users with launchpad.Driver can view sharees.
driver = self.factory.makePerson()
distro = self.factory.makeDistribution(driver=driver)
login_person(driver)
- self._test_getPillarObservers(distro)
+ self._test_getPillarSharees(distro)
- def _test_getPillarObserversUnauthorized(self, pillar):
- # getPillarObservers raises an Unauthorized exception if the user is
+ def _test_getPillarShareesUnauthorized(self, pillar):
+ # getPillarSharees raises an Unauthorized exception if the user is
# not permitted to do so.
access_policy = self.factory.makeAccessPolicy(pillar=pillar)
grantee = self.factory.makePerson()
self.factory.makeAccessPolicyGrant(access_policy, grantee)
self.assertRaises(
- Unauthorized, self.service.getPillarObservers, pillar)
+ Unauthorized, self.service.getPillarSharees, pillar)
- def test_getPillarObserversAnonymous(self):
+ def test_getPillarShareesAnonymous(self):
# Anonymous users are not allowed.
product = self.factory.makeProduct()
login(ANONYMOUS)
- self._test_getPillarObserversUnauthorized(product)
+ self._test_getPillarShareesUnauthorized(product)
- def test_getPillarObserversAnyone(self):
+ def test_getPillarShareesAnyone(self):
# Unauthorized users are not allowed.
product = self.factory.makeProduct()
login_person(self.factory.makePerson())
- self._test_getPillarObserversUnauthorized(product)
+ self._test_getPillarShareesUnauthorized(product)
- def _test_updatePillarObserver(self, pillar):
- """updatePillarObservers works and returns the expected data."""
- observer = self.factory.makePerson()
+ def _test_updatePillarSharee(self, pillar):
+ """updatePillarSharees works and returns the expected data."""
+ sharee = self.factory.makePerson()
grantor = self.factory.makePerson()
- # Make existing grants to ensure updatePillarObserver handles those
+ # Make existing grants to ensure updatePillarSharee handles those
# cases correctly.
# First, a grant that is in the add set - it wil be retained.
policy = self.factory.makeAccessPolicy(
pillar=pillar, type=InformationType.EMBARGOEDSECURITY)
self.factory.makeAccessPolicyGrant(
- policy, grantee=observer, grantor=grantor)
+ policy, grantee=sharee, grantor=grantor)
# Second, a grant that is not in the add set - it will be deleted.
policy = self.factory.makeAccessPolicy(
pillar=pillar, type=InformationType.PROPRIETARY)
self.factory.makeAccessPolicyGrant(
- policy, grantee=observer, grantor=grantor)
+ policy, grantee=sharee, grantor=grantor)
- # Now call updatePillarObserver will the grants we want.
+ # Now call updatePillarSharee will the grants we want.
information_types = [
InformationType.EMBARGOEDSECURITY,
InformationType.USERDATA]
- observer_data = self.service.updatePillarObserver(
- pillar, observer, information_types, grantor)
+ sharee_data = self.service.updatePillarSharee(
+ pillar, sharee, information_types, grantor)
policies = getUtility(IAccessPolicySource).findByPillar([pillar])
policy_grant_source = getUtility(IAccessPolicyGrantSource)
grants = policy_grant_source.findByPolicy(policies)
self.assertEqual(grants.count(), len(information_types))
for grant in grants:
self.assertEqual(grantor, grant.grantor)
- self.assertEqual(observer, grant.grantee)
+ self.assertEqual(sharee, grant.grantee)
self.assertIn(grant.policy.type, information_types)
- expected_observer_data = self._makeObserverData(
- observer, information_types)
- self.assertEqual(expected_observer_data, observer_data)
+ expected_sharee_data = self._makeShareeData(
+ sharee, information_types)
+ self.assertEqual(expected_sharee_data, sharee_data)
- def test_updateProjectGroupObserver_not_allowed(self):
- # We cannot add observers to ProjectGroups.
+ def test_updateProjectGroupSharee_not_allowed(self):
+ # We cannot add sharees to ProjectGroups.
owner = self.factory.makePerson()
project_group = self.factory.makeProject(owner=owner)
- observer = self.factory.makePerson()
+ sharee = self.factory.makePerson()
login_person(owner)
self.assertRaises(
- AssertionError, self.service.updatePillarObserver,
- project_group, observer, [InformationType.USERDATA], owner)
+ AssertionError, self.service.updatePillarSharee,
+ project_group, sharee, [InformationType.USERDATA], owner)
- def test_updateProductObserver(self):
- # Users with launchpad.Edit can add observers.
+ def test_updateProductSharee(self):
+ # Users with launchpad.Edit can add sharees.
owner = self.factory.makePerson()
product = self.factory.makeProduct(owner=owner)
login_person(owner)
- self._test_updatePillarObserver(product)
+ self._test_updatePillarSharee(product)
- def test_updateDistroObserver(self):
- # Users with launchpad.Edit can add observers.
+ def test_updateDistroSharee(self):
+ # Users with launchpad.Edit can add sharees.
owner = self.factory.makePerson()
distro = self.factory.makeDistribution(owner=owner)
login_person(owner)
- self._test_updatePillarObserver(distro)
+ self._test_updatePillarSharee(distro)
- def _test_updatePillarObserverUnauthorized(self, pillar):
- # updatePillarObserver raises an Unauthorized exception if the user is
+ def _test_updatePillarShareeUnauthorized(self, pillar):
+ # updatePillarSharee raises an Unauthorized exception if the user is
# not permitted to do so.
- observer = self.factory.makePerson()
+ sharee = self.factory.makePerson()
user = self.factory.makePerson()
self.assertRaises(
- Unauthorized, self.service.updatePillarObserver,
- pillar, observer, [InformationType.USERDATA], user)
+ Unauthorized, self.service.updatePillarSharee,
+ pillar, sharee, [InformationType.USERDATA], user)
- def test_updatePillarObserverAnonymous(self):
+ def test_updatePillarShareeAnonymous(self):
# Anonymous users are not allowed.
product = self.factory.makeProduct()
login(ANONYMOUS)
- self._test_updatePillarObserverUnauthorized(product)
+ self._test_updatePillarShareeUnauthorized(product)
- def test_updatePillarObserverAnyone(self):
+ def test_updatePillarShareeAnyone(self):
# Unauthorized users are not allowed.
product = self.factory.makeProduct()
login_person(self.factory.makePerson())
- self._test_updatePillarObserverUnauthorized(product)
+ self._test_updatePillarShareeUnauthorized(product)
- def _test_deletePillarObserver(self, pillar, types_to_delete=None):
+ def _test_deletePillarSharee(self, pillar, types_to_delete=None):
# Make grants for some information types.
information_types = [
InformationType.EMBARGOEDSECURITY,
@@ -237,65 +237,65 @@
pillar=pillar, type=info_type)
access_policies.append(access_policy)
grantee = self.factory.makePerson()
- # Make some access policy grants for our observer.
+ # Make some access policy grants for our sharee.
for access_policy in access_policies:
self.factory.makeAccessPolicyGrant(access_policy, grantee)
- # Make some artifact grants for our observer.
+ # Make some artifact grants for our sharee.
artifact = self.factory.makeAccessArtifact()
self.factory.makeAccessArtifactGrant(artifact, grantee)
for access_policy in access_policies:
self.factory.makeAccessPolicyArtifact(
artifact=artifact, policy=access_policy)
- # Make some access policy grants for another observer.
+ # Make some access policy grants for another sharee.
another = self.factory.makePerson()
self.factory.makeAccessPolicyGrant(access_policies[0], another)
# Delete data for a specific information type.
- self.service.deletePillarObserver(pillar, grantee, types_to_delete)
+ self.service.deletePillarSharee(pillar, grantee, types_to_delete)
# Assemble the expected data for the remaining access grants for
# grantee.
expected_data = []
if types_to_delete is not None:
expected_information_types = (
set(information_types).difference(types_to_delete))
- remaining_grantee_person_data = self._makeObserverData(
+ remaining_grantee_person_data = self._makeShareeData(
grantee, expected_information_types)
expected_data.append(remaining_grantee_person_data)
- # Add the data for the other observer.
- another_person_data = self._makeObserverData(
+ # Add the data for the other sharee.
+ another_person_data = self._makeShareeData(
another, information_types[:1])
expected_data.append(another_person_data)
self.assertContentEqual(
- expected_data, self.service.getPillarObservers(pillar))
-
- def test_deleteProductObserverAll(self):
- # Users with launchpad.Edit can delete all access for an observer.
- owner = self.factory.makePerson()
- product = self.factory.makeProduct(owner=owner)
- login_person(owner)
- self._test_deletePillarObserver(product)
-
- def test_deleteProductObserverPolicies(self):
- # Users with launchpad.Edit can delete selected policy access for an
- # observer.
- owner = self.factory.makePerson()
- product = self.factory.makeProduct(owner=owner)
- login_person(owner)
- self._test_deletePillarObserver(product, [InformationType.USERDATA])
-
- def test_deleteDistroObserverAll(self):
- # Users with launchpad.Edit can delete all access for an observer.
- owner = self.factory.makePerson()
- distro = self.factory.makeDistribution(owner=owner)
- login_person(owner)
- self._test_deletePillarObserver(distro)
-
- def test_deleteDistroObserverPolicies(self):
- # Users with launchpad.Edit can delete selected policy access for an
- # observer.
- owner = self.factory.makePerson()
- distro = self.factory.makeDistribution(owner=owner)
- login_person(owner)
- self._test_deletePillarObserver(distro, [InformationType.USERDATA])
+ expected_data, self.service.getPillarSharees(pillar))
+
+ def test_deleteProductShareeAll(self):
+ # Users with launchpad.Edit can delete all access for a sharee.
+ owner = self.factory.makePerson()
+ product = self.factory.makeProduct(owner=owner)
+ login_person(owner)
+ self._test_deletePillarSharee(product)
+
+ def test_deleteProductShareeSelectedPolicies(self):
+ # Users with launchpad.Edit can delete selected policy access for an
+ # sharee.
+ owner = self.factory.makePerson()
+ product = self.factory.makeProduct(owner=owner)
+ login_person(owner)
+ self._test_deletePillarSharee(product, [InformationType.USERDATA])
+
+ def test_deleteDistroShareeAll(self):
+ # Users with launchpad.Edit can delete all access for a sharee.
+ owner = self.factory.makePerson()
+ distro = self.factory.makeDistribution(owner=owner)
+ login_person(owner)
+ self._test_deletePillarSharee(distro)
+
+ def test_deleteDistroShareeSelectedPolicies(self):
+ # Users with launchpad.Edit can delete selected policy access for an
+ # sharee.
+ owner = self.factory.makePerson()
+ distro = self.factory.makeDistribution(owner=owner)
+ login_person(owner)
+ self._test_deletePillarSharee(distro, [InformationType.USERDATA])
class ApiTestMixin:
@@ -311,15 +311,15 @@
policy=access_policy, grantee=self.grantee)
transaction.commit()
- def test_getPillarObservers(self):
- # Test the getPillarObservers method.
- [json_data] = self._getPillarObservers()
+ def test_getPillarSharees(self):
+ # Test the getPillarSharees method.
+ [json_data] = self._getPillarSharees()
self.assertEqual('grantee', json_data['name'])
self.assertIn('permissions', json_data)
class TestWebService(ApiTestMixin, WebServiceTestCase):
- """Test the web service interface for the Access Policy Service."""
+ """Test the web service interface for the Sharing Service."""
def setUp(self):
super(TestWebService, self).setUp()
@@ -328,25 +328,25 @@
def test_url(self):
# Test that the url for the service is correct.
- service = AccessPolicyService()
+ service = SharingService()
root_app = getUtility(ILaunchpadRoot)
self.assertEqual(
- '%s+services/accesspolicy' % canonical_url(root_app),
+ '%s+services/sharing' % canonical_url(root_app),
canonical_url(service))
def _named_get(self, api_method, **kwargs):
return self.webservice.named_get(
- '/+services/accesspolicy',
+ '/+services/sharing',
api_method, api_version='devel', **kwargs).jsonBody()
- def _getPillarObservers(self):
+ def _getPillarSharees(self):
pillar_uri = canonical_url(self.pillar, force_local_path=True)
return self._named_get(
- 'getPillarObservers', pillar=pillar_uri)
+ 'getPillarSharees', pillar=pillar_uri)
class TestLaunchpadlib(ApiTestMixin, TestCaseWithFactory):
- """Test launchpadlib access for the Access Policy Service."""
+ """Test launchpadlib access for the Sharing Service."""
layer = AppServerLayer
@@ -354,11 +354,11 @@
super(TestLaunchpadlib, self).setUp()
self.launchpad = self.factory.makeLaunchpadService(person=self.driver)
- def _getPillarObservers(self):
+ def _getPillarSharees(self):
# XXX 2012-02-23 wallyworld bug 681767
# Launchpadlib can't do relative url's
service = self.launchpad.load(
- '%s/+services/accesspolicy' % self.launchpad._root_uri)
+ '%s/+services/sharing' % self.launchpad._root_uri)
ws_pillar = ws_object(self.launchpad, self.pillar)
# login_person(self.driver)
- return service.getPillarObservers(pillar=ws_pillar)
+ return service.getPillarSharees(pillar=ws_pillar)
=== modified file 'lib/lp/registry/templates/pillar-sharing.pt'
--- lib/lp/registry/templates/pillar-sharing.pt 2012-03-02 23:09:34 +0000
+++ lib/lp/registry/templates/pillar-sharing.pt 2012-03-08 03:22:19 +0000
@@ -11,11 +11,11 @@
<metal:block fill-slot="head_epilogue">
<script tal:content="structure string:
LPJS.use('base', 'node', 'event',
- 'lp.registry.disclosure.pillarsharingview',
+ 'lp.registry.sharing.pillarsharingview',
function(Y) {
Y.on('domready', function() {
var config = ${view/json_sharing_picker_config}
- var view_widget = new Y.lp.registry.disclosure.pillarsharingview.PillarSharingView(config);
+ var view_widget = new Y.lp.registry.sharing.pillarsharingview.PillarSharingView(config);
view_widget.render();
});
});
@@ -29,7 +29,7 @@
shared with these users and teams.
</p>
- <table id="observer-table" class="disclosure listing">
+ <table id="sharee-table" class="disclosure listing">
</table>
</div>
@@ -41,7 +41,7 @@
set the numbers in this portlet.
</tal:comment>
<div id="portlet-disclosure-links" class="first portlet">
- <a id='add-observer-link' class='sprite add js-action' href="#">Share</a>
+ <a id='add-sharee-link' class='sprite add js-action' href="#">Share</a>
</div>
<div id="portlet-disclosure-summary" class="portlet">
<p>