make_request now checks policy table, however set_policy function currently not working
This commit is contained in:
		| @@ -357,10 +357,14 @@ function modpol.orgs:make_request(request) | ||||
|         end | ||||
|     end | ||||
|  | ||||
|     -- checking to see if user is able to make request | ||||
|     local requested_policy = self.policies[request.type] | ||||
|     -- if requested_policy then | ||||
|          | ||||
|     -- end | ||||
|     if requested_policy then | ||||
|         if requested_policy.must_be_member and not self:has_member(request.user) then | ||||
|             modpol.ocutil.log("Error: user must be org member to make this request") | ||||
|             return false | ||||
|         end | ||||
|     end | ||||
|  | ||||
|     -- linear search for empty process slots (lazy deletion) | ||||
|     for k, v in ipairs(self.requests) do | ||||
| @@ -371,16 +375,20 @@ function modpol.orgs:make_request(request) | ||||
|     end | ||||
|  | ||||
|     -- attempts to fill empty spots in list, otherwise appends to end | ||||
|     local request_id = nil | ||||
|     if empty_index then | ||||
|         self.requests[empty_index] = request | ||||
|         return empty_index | ||||
|         request_id = empty_index | ||||
|     else | ||||
|         table.insert(self.requests, request) | ||||
|         -- finds end of list to return current request's id | ||||
|         local count = 0 | ||||
|         for k, v in ipairs(t) do  | ||||
|         for k, v in ipairs(self.requests) do  | ||||
|             count = count + 1  | ||||
|         end | ||||
|         return count | ||||
|         request_id = count | ||||
|     end | ||||
|     modpol.ocutil.log("Request made") | ||||
|  | ||||
|     return request_id | ||||
| end | ||||
		Reference in New Issue
	
	Block a user