Permalink
Browse files

created users-core

  • Loading branch information...
0 parents commit b42abea2674e5dfc75f06ef3ca9172ffba647709 @caolan committed Jun 7, 2012
Showing 603 changed files with 133,021 additions and 0 deletions.
@@ -0,0 +1,89 @@
+.center-form form {
+ margin-bottom: 0;
+}
+
+.center-form {
+ margin: 6em auto 0 auto;
+ display: block;
+ width: 560px;
+ border: 20px solid white;
+ background: white;
+}
+
+.center-form .form-actions {
+ margin-bottom: 0;
+}
+
+.page {
+ padding-top: 2em;
+}
+
+.profile-table th {
+ min-width: 128px;
+}
+.profile-table td {
+ width: 100%;
+}
+.profile-table td .edit-link {
+ margin-left: 1em;
+}
+.profile-table .empty {
+ color: #999;
+}
+.update-photo {
+ width: 100%;
+ margin-top: 4px;
+ max-width: 128px;
+}
+.update-photo .btn {
+ display: block;
+}
+.profile-table .field-editor {
+ display: none;
+ margin-bottom: 0px;
+}
+.profile-table td .value {
+ display: inline;
+}
+.profile-table .field-editor .control-group {
+ margin-bottom: 0;
+}
+.profile-table .field-editor textarea {
+ min-height: 150px;
+}
+
+#profilelist {
+ margin: 1.618em 0;
+ padding: 0;
+ list-style-type: none;
+}
+li.profile {
+ margin: 0 0 16px 0;
+ padding: 0;
+ list-style-type: none;
+ min-height: 48px;
+}
+li.profile .avatar {
+ float: left;
+ width: 48px;
+ height: 48px;
+}
+li.profile .details {
+ padding-left: 64px;
+}
+li.profile .name {
+ font-weight: bold;
+}
+#profilelist-nav .prev-link {
+ margin-right: 1em;
+}
+#profilelist-nav .next-link {
+ margin-left: 1em;
+}
+#profilelist-nav .disabled {
+ color: #999;
+ cursor: default;
+}
+#profilelist-nav .disabled:hover {
+ text-decoration: none;
+}
@@ -0,0 +1,48 @@
+exports.rewrites = [
+ {from: '/', to: 'index.html'},
+ {from: '/*', to: '*'}
+];
+
+exports.views = {
+ profiles: {
+ map: function (doc) {
+ if (doc.type === 'profile') {
+ emit(doc.name, null);
+ }
+ }
+ }
+};
+
+exports.validate_doc_update = function (newDoc, oldDoc, userCtx) {
+ if ((oldDoc && oldDoc.type === 'profile') || newDoc.type === 'profile') {
+ for (var i = 0; i < userCtx.roles.lenth; i++) {
+ if (userCtx.roles[i] === '_admin') {
+ // _admin users can do anything
+ return;
+ }
+ }
+ if (!userCtx.name) {
+ throw {unauthorized: 'You must be logged in'};
+ }
+ if (oldDoc) {
+ if (newDoc._deleted) {
+ // remove
+ if (userCtx.name !== oldDoc.name) {
+ throw {unauthorized: 'Only the owner can remove a profile'};
+ }
+ }
+ else {
+ // update
+ if (userCtx.name !== oldDoc.name) {
+ throw {unauthorized: 'Only the owner can update a profile'};
+ }
+ }
+ }
+ else {
+ // create
+ if (userCtx.name !== newDoc.name) {
+ throw {unauthorized: 'profile.name must match your username'};
+ }
+ }
+ }
+};
Oops, something went wrong.

0 comments on commit b42abea

Please sign in to comment.