def set_acls(self, owner_uuid, aclsd): """ allow each Module class to have a set_acls call, but catch here and then pass generic function the right UserRoleX klass. Still want to find way to generically follow sqla""" super(Module, self).set_acls(owner_uuid, aclsd, UserRoleModule) db_session.add(self) db_session.commit()
def set_acls(self, owner_uuid, aclsd): """ allow each Folder / collection class to have a set_acls call, but catch here and then pass generic function the right UserRoleX klass. Still want to find way to generically follow sqla. convern - this is beginning to smell like java.""" super(Folder, self).set_acls(owner_uuid, aclsd, UserRoleFolder) db_session.add(self) db_session.commit()
def put_o(jsond, klass, ID, requesting_user_uri): """Given a user_id, and a json_str representing the "Updated" fields then update those fields for that user_id """ uobj = get_by_id(klass, ID, requesting_user_uri) if not change_approval(uobj, jsond, requesting_user_uri, "PUT"): abort(403) #.. todo:: parser = verify_schema_version(None) uobj.populate_self(jsond) db_session.add(uobj) db_session.commit() return uobj
def post_o(klass, incomingd, requesting_user_uri): """Given a dict representing the complete set of fields then create a new user and those fields I am getting a dictionary direct form Flask request object - want to handle that myself with parser. returns User object, for later saveing to DB""" u = klass(creator_uuid=requesting_user_uri) # parser = verify_schema_version(None) # incomingd = parser(json_str) u.populate_self(incomingd) if not change_approval(u, incomingd, requesting_user_uri, "POST"): abort(403) db_session.add(u) db_session.commit() return u