@@ -145,22 +145,20 @@ public ActionResult Save(EventModel model, HttpPostedFileBase file)
145145 using ( EntityPermissionManager pManager = new EntityPermissionManager ( ) )
146146 {
147147 Entity entityType = entityTypeManager . FindByName ( "Event" ) ;
148-
149- var adminGroup = groupManager . FindByNameAsync ( "administrator" ) . Result ;
150- //temp hartcoded until the new settings implementation is available
151- var beoGroup = groupManager . FindByNameAsync ( "beo" ) . Result ;
152-
153- int fullRights = ( int ) RightType . Read + ( int ) RightType . Write + ( int ) RightType . Delete + ( int ) RightType . Grant ;
154-
155- if ( adminGroup != null )
156- {
157- if ( pManager . GetRights ( adminGroup . Id , entityType . Id , newEvent . Id ) == 0 )
158- pManager . Create ( adminGroup . Id , entityType . Id , newEvent . Id , fullRights ) ;
159- }
160- if ( beoGroup != null )
148+ string [ ] eventAdminGroups = Helper . Settings . get ( "EventAdminGroups" ) . ToString ( ) . Split ( ',' ) ;
149+ if ( eventAdminGroups != null && eventAdminGroups . Length > 0 )
161150 {
162- if ( pManager . GetRights ( beoGroup . Id , entityType . Id , newEvent . Id ) == 0 )
163- pManager . Create ( beoGroup . Id , entityType . Id , newEvent . Id , fullRights ) ;
151+ foreach ( var g in eventAdminGroups )
152+ {
153+ int fullRights = ( int ) RightType . Read + ( int ) RightType . Write + ( int ) RightType . Delete + ( int ) RightType . Grant ;
154+ var group = groupManager . FindByNameAsync ( g ) . Result ;
155+ if ( group != null )
156+ {
157+ if ( pManager . GetRights ( group . Id , entityType . Id , newEvent . Id ) == 0 )
158+ pManager . Create ( group . Id , entityType . Id , newEvent . Id , fullRights ) ;
159+ }
160+
161+ }
164162 }
165163 }
166164 }
0 commit comments