@@ -29,6 +29,23 @@ import {
29
29
import { configSchema } from "../utils/schemaSettings" ;
30
30
import { FormuleForm } from "react-formule" ;
31
31
32
+ // Left as documentation
33
+ /*
34
+ const initialStatePermissions = Map({
35
+ deposit: {
36
+ read: { users: [], roles: [] },
37
+ update: { users: [], roles: [] },
38
+ admin: { users: [], roles: [] },
39
+ review: { users: [], roles: [] },
40
+ create: { users: [], roles: [] },
41
+ },
42
+ records: {
43
+ read: { users: [], roles: [] },
44
+ review: { users: [], roles: [] },
45
+ },
46
+ });
47
+ */
48
+
32
49
const Permissions = ( {
33
50
schemaName,
34
51
schemaVersion,
@@ -38,11 +55,12 @@ const Permissions = ({
38
55
deleteSchemaPermissions,
39
56
config,
40
57
updateSchemaConfig,
58
+ isNew,
41
59
} ) => {
42
60
const [ editable , setEditable ] = useState ( false ) ;
43
61
const [ addEnabled , setAddEnabled ] = useState ( false ) ;
44
62
useEffect ( ( ) => {
45
- getSchemaPermissions ( schemaName , schemaVersion ) ;
63
+ ! isNew && getSchemaPermissions ( schemaName , schemaVersion ) ;
46
64
} , [ ] ) ;
47
65
48
66
const addSchemaPermissionsToEmail = (
@@ -148,7 +166,7 @@ const Permissions = ({
148
166
< Typography . Paragraph style = { { marginBottom : 0 } } >
149
167
Here you can manage access to your{ " " }
150
168
< Typography . Text strong >
151
- { schemaName } ( { schemaVersion } )
169
+ { schemaName } { schemaVersion && `( $ {schemaVersion } )` }
152
170
</ Typography . Text > { " " }
153
171
collection. You can determine who can perform specific
154
172
action for both states of your document
@@ -205,8 +223,8 @@ Permissions.propTypes = {
205
223
206
224
const mapStateToProps = state => {
207
225
return {
208
- schemaName : state . builder . get ( "formuleState" ) . config . name ,
209
- schemaVersion : state . builder . get ( "formuleState" ) . config . version ,
226
+ schemaName : state . builder . getIn ( [ " config" , " name" ] ) ,
227
+ schemaVersion : state . builder . getIn ( [ " config" , " version" ] ) ,
210
228
permissions : state . builder . get ( "permissions" ) ,
211
229
config : state . builder . get ( "config" ) ,
212
230
} ;
0 commit comments