     
     /// Asks the delegate for access control for a request.
     /// Server must have its permissions enabled for this method to be called. */
-    func server<T: ServerType>(server: T, permissionForRequest context: Server.RequestContext, resource: Resource, key: String?) -> AccessControl
-}
-
-
+    func server<T: ServerType>(server: T, permissionForRequest context: Server.RequestContext, resource: Resource?, key: String?) -> AccessControl
+}
+
+

                
                guard propertyVisible else {
                    
                    values[key] = Value.Null
                    
                    continue
                }

    }
    
    /// check for write permissions and validates changes
    func editPermission(values: ValuesObject, entity: Entity, model: [Entity], resource: Resource?, context: Server.RequestContext) -> Bool {
        
        // check edit permissions
        if let permissionsDelegate = self.permissionsDelegate {
            
            for (key, value) in values {
                
                // check property permission
                
                let propertyEditable = permissionsDelegate.server(self, permissionForRequest: context, resource: resource, key: key).rawValue == AccessControl.ReadWrite.rawValue
                
                guard propertyEditable else { return false }
                
                if let relationship = entity.relationships.filter({ (element) -> Bool in element.name == key }).first {
                    
                    let destinationEntity = model.filter({ (entity) -> Bool in
                        entity.name == relationship.destinationEntityName
                    }).first!
                    
                    switch value {
                        
                    case let .Relationship(.ToOne(resourceID)):
                    
                    
                        
                    case let .Relationship(.ToMany(resourceIDs)):
                        
                        
                    }
                }
            }
        }
        
        return true
