Browse Source

remove the None access level

Mark deVilliers 2 years ago
parent
commit
6bb4b4fb7c
5 changed files with 5 additions and 43 deletions
  1. 1 2
      node/api/entitlements.go
  2. 3 24
      ui/node.js
  3. 0 3
      ui/search.js
  4. 1 5
      ui/src/Decoders.elm
  5. 0 9
      ui/src/Node.elm

+ 1 - 2
node/api/entitlements.go

@@ -19,7 +19,7 @@ type ErrorResponse struct {
19 19
 // EntitlementRequest are made to request some access to a bit of data
20 20
 type EntitlementRequest struct {
21 21
 	Subject     string      `json:"subject" description:"path of the data e.g. data://user/email" validate:"nonzero"`
22
-	AccessLevel AccessLevel `json:"level" description:"access level requested. Valid values 'none','can-read','can-discover'" validate:"nonzero"`
22
+	AccessLevel AccessLevel `json:"level" description:"access level requested. Valid values 'owner-only', 'can-read','can-discover'" validate:"nonzero"`
23 23
 }
24 24
 
25 25
 //Entitlement is returned to encapsulate the current status of the entitlement
@@ -43,7 +43,6 @@ func (e Entitlement) IsAccessible() bool {
43 43
 type AccessLevel string
44 44
 
45 45
 const (
46
-	None        = AccessLevel("none")
47 46
 	OwnerOnly   = AccessLevel("owner-only")
48 47
 	CanAccess   = AccessLevel("can-access")
49 48
 	CanDiscover = AccessLevel("can-discover")

+ 3 - 24
ui/node.js

@@ -10494,14 +10494,11 @@ var _user$project$Decoders$decodeDataResponse = A2(
10494 10494
 var _user$project$Decoders$CanDiscover = {ctor: 'CanDiscover'};
10495 10495
 var _user$project$Decoders$CanAccess = {ctor: 'CanAccess'};
10496 10496
 var _user$project$Decoders$OwnerOnly = {ctor: 'OwnerOnly'};
10497
-var _user$project$Decoders$None = {ctor: 'None'};
10498 10497
 var _user$project$Decoders$decodeAccessLevel = A2(
10499 10498
 	_elm_lang$core$Json_Decode$andThen,
10500 10499
 	function (str) {
10501 10500
 		var _p2 = str;
10502 10501
 		switch (_p2) {
10503
-			case 'none':
10504
-				return _elm_lang$core$Json_Decode$succeed(_user$project$Decoders$None);
10505 10502
 			case 'owner-only':
10506 10503
 				return _elm_lang$core$Json_Decode$succeed(_user$project$Decoders$OwnerOnly);
10507 10504
 			case 'can-access':
@@ -10544,10 +10541,8 @@ var _user$project$Node$drawAccessLevel = function (level) {
10544 10541
 			return _elm_lang$html$Html$text('owner-only');
10545 10542
 		case 'CanDiscover':
10546 10543
 			return _elm_lang$html$Html$text('can-discover');
10547
-		case 'CanAccess':
10548
-			return _elm_lang$html$Html$text('can-access');
10549 10544
 		default:
10550
-			return _elm_lang$html$Html$text('none');
10545
+			return _elm_lang$html$Html$text('can-access');
10551 10546
 	}
10552 10547
 };
10553 10548
 var _user$project$Node$subscriptions = function (model) {
@@ -10560,10 +10555,8 @@ var _user$project$Node$accessLevelEncoder = function (level) {
10560 10555
 			return _elm_lang$core$Json_Encode$string('owner-only');
10561 10556
 		case 'CanDiscover':
10562 10557
 			return _elm_lang$core$Json_Encode$string('can-discover');
10563
-		case 'CanAccess':
10564
-			return _elm_lang$core$Json_Encode$string('can-access');
10565 10558
 		default:
10566
-			return _elm_lang$core$Json_Encode$string('none');
10559
+			return _elm_lang$core$Json_Encode$string('can-access');
10567 10560
 	}
10568 10561
 };
10569 10562
 var _user$project$Node$entitlementEncoder = function (ent) {
@@ -10712,7 +10705,7 @@ var _user$project$Node$drawAccessLevelSelector = function (ent) {
10712 10705
 						}
10713 10706
 					}
10714 10707
 				});
10715
-		case 'CanAccess':
10708
+		default:
10716 10709
 			return A2(
10717 10710
 				_elm_lang$html$Html$span,
10718 10711
 				{ctor: '[]'},
@@ -10740,20 +10733,6 @@ var _user$project$Node$drawAccessLevelSelector = function (ent) {
10740 10733
 						}),
10741 10734
 					_1: {ctor: '[]'}
10742 10735
 				});
10743
-		default:
10744
-			return A2(
10745
-				_elm_lang$html$Html$span,
10746
-				{ctor: '[]'},
10747
-				{
10748
-					ctor: '::',
10749
-					_0: _elm_lang$html$Html$text('nothing to be done : '),
10750
-					_1: {
10751
-						ctor: '::',
10752
-						_0: _elm_lang$html$Html$text(
10753
-							_elm_lang$core$Basics$toString(ent.level)),
10754
-						_1: {ctor: '[]'}
10755
-					}
10756
-				});
10757 10736
 	}
10758 10737
 };
10759 10738
 var _user$project$Node$drawAccepted = function (ent) {

+ 0 - 3
ui/search.js

@@ -10560,14 +10560,11 @@ var _user$project$Decoders$decodeDataResponse = A2(
10560 10560
 var _user$project$Decoders$CanDiscover = {ctor: 'CanDiscover'};
10561 10561
 var _user$project$Decoders$CanAccess = {ctor: 'CanAccess'};
10562 10562
 var _user$project$Decoders$OwnerOnly = {ctor: 'OwnerOnly'};
10563
-var _user$project$Decoders$None = {ctor: 'None'};
10564 10563
 var _user$project$Decoders$decodeAccessLevel = A2(
10565 10564
 	_elm_lang$core$Json_Decode$andThen,
10566 10565
 	function (str) {
10567 10566
 		var _p2 = str;
10568 10567
 		switch (_p2) {
10569
-			case 'none':
10570
-				return _elm_lang$core$Json_Decode$succeed(_user$project$Decoders$None);
10571 10568
 			case 'owner-only':
10572 10569
 				return _elm_lang$core$Json_Decode$succeed(_user$project$Decoders$OwnerOnly);
10573 10570
 			case 'can-access':

+ 1 - 5
ui/src/Decoders.elm

@@ -113,8 +113,7 @@ type alias Entitlement =
113 113
 
114 114
 
115 115
 type AccessLevel
116
-    = None
117
-    | OwnerOnly
116
+    = OwnerOnly
118 117
     | CanAccess
119 118
     | CanDiscover
120 119
 
@@ -134,9 +133,6 @@ decodeAccessLevel =
134 133
         |> Json.Decode.andThen
135 134
             (\str ->
136 135
                 case str of
137
-                    "none" ->
138
-                        Json.Decode.succeed None
139
-
140 136
                     "owner-only" ->
141 137
                         Json.Decode.succeed OwnerOnly
142 138
 

+ 0 - 9
ui/src/Node.elm

@@ -180,9 +180,6 @@ accessLevelEncoder level =
180 180
         Decoders.CanAccess ->
181 181
             Json.Encode.string "can-access"
182 182
 
183
-        Decoders.None ->
184
-            Json.Encode.string "none"
185
-
186 183
 
187 184
 amendEntitlement : Decoders.Entitlement -> Cmd Msg
188 185
 amendEntitlement ent =
@@ -270,9 +267,6 @@ drawAccessLevelSelector ent =
270 267
         Decoders.CanAccess ->
271 268
             Html.span [] [ a [ onClick (AmendEntitlement { ent | level = Decoders.CanDiscover }), href "#" ] [ text ("remove access") ] ]
272 269
 
273
-        Decoders.None ->
274
-            Html.span [] [ text ("nothing to be done : "), text (toString ent.level) ]
275
-
276 270
 
277 271
 drawAccessLevel : Decoders.AccessLevel -> Html Msg
278 272
 drawAccessLevel level =
@@ -286,9 +280,6 @@ drawAccessLevel level =
286 280
         Decoders.CanAccess ->
287 281
             text ("can-access")
288 282
 
289
-        Decoders.None ->
290
-            text ("none")
291
-
292 283
 
293 284
 drawRequested : Maybe Decoders.Entitlement -> Html Msg
294 285
 drawRequested ent =